Header

How do I upload my project's public SSH key to my authorized_keys file?

Quite often, when connecting to a server via SSH, you'll be doing so with a public key.

Each DeployHQ project has its own unique key pair, and the public key will need to be added to the appropriate user's authorized_keys file on your server, so that we can log in as that user.

Firstly, you can access the project's public key from either the new server page when you're adding a new server, or, the Configuration page. You'll need to enable the option to use an SSH key for authentication so that the public key is displayed.

SSH Key

You can do this by logging into the server as the user, or assuming that user by typing su -username-of-user in your terminal when logged in as any other user.

Then, you can follow these steps:

cd ~/.ssh/
nano ~/.ssh/authorized_keys

If the folder doesn't already exist, simply type mkdir ~/.ssh before the cd command.

Paste DeployHQ’s public key, then press Ctrl + X, y then Enter to save.

You can also run the following commands to ensure that permissions of both the user's /.ssh directory and authorized_keys file are set correctly:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys