Use service users for continuous deployment
An infrastructure that uses continuous deployment automation often requires SSH to deploy software or to perform tasks. Generally, this kind of automation runs SSH using a local user account on a continuous integration/continuous deployment (CI/CD) server that's dedicated to this purpose. For example, automated Jenkins jobs might be run as the 'jenkins' user on a Linux server. With Advanced Server Access, you can create service users to automate deployment to your target servers.
- Before you begin
- Create a service user for continuous deployment
- Create a service for a project
- Add the service user to a group
- Enable service user authentication
Before you begin
You must install the Advanced Server Access client on the host whose unmanaged user the service user is tied to.
Note: The server can be any Linux host. The server can't be a Windows or FreeBSD host. See Install the Advanced Server Access client.
Grant a group access to the host that contains the service user account.
Create a service user for continuous deployment
- From the Advanced Server Access dashboard, click Users.
- Select the Service Users tab.
- Click Create Service User. The Create Service User page appears.
- Enter a username for the service user. The system automatically creates corresponding Linux and Windows usernames. Click Create Service User to finish creating the service user.
- Click Create API Key. The API Key Secret Rotated page appears.
- Copy and store your API key ID and your API key secret from this page.
Note: You cannot retrieve this information after closing the window. If you lose this information, you must generate a new API ID & key.
Create a service for a project
- Click Projects on your team's Advanced Server Access dashboard. The Projects page appears.
- Click the project that contains the server that runs the service to assign to the service user.
- Select the Servers tab.
- Choose the server on which to use the service user.
- Select the Services tab. Click Add Service.
Select the service user that you created from the Service User dropdown. Enter the UID of an unmanaged user in the UID field.
Note: To find the UID of a user, use the
ls /homecommand to list the users on the server, then use the
id <user>command to find the UID of a specific user.
Add the service user to a group
- Click Groups on the Advanced Server Access dashboard.
- Select a group that belongs to the project that contains the server that the service user will be deployed to.
- Select the Users tab.
- Enter the username of the service user that you created. Click Add User.
Enable service user authentication
Ensure that you've installed the Advanced Server Access client on the server that's tied to the service user that you created. By installing the client and enabling authentication for service users, the service user's credentials can be used to perform tasks.
Note: The Advanced Server Access server agent must be installed and running on the server.
Connect to the server for the service user:
- Switch to the unmanaged user that's tied to the Advanced Server Access service user:
Enable service user authentication:
sft config service_auth.enable true
Update your SSH configuration:
sft ssh-config >> ~/.ssh/config
Note: Don't forget to change the command if your SSH configuration file is in a different directory.
su - <unmanaged-user>