Setup SSH Certificate in Linux


A SSH certificate allows you to connect to another server without entering a password. The client and server do a public/private key exchange, and use that to authenticate instead of a password. This is useful for running cron jobs where you can't type in the username.

Step 1


Login to your server through SSH and setup the certificate. Check to see if the key already exists.
$ cat ~/.ssh/id_dsa.pub
If the key already exists, go on to step 3.

Step 2


Create the public key for this user. Leave all the options default, including no password.
$ ssh-keygen -t dsa

Step 3


Copy the public key to BackupBus.com. You can do this through any method you like, but the below is probably easiest. It could take a minute while your server tries to authenticate the BackupBus servers. If asked to continue connecting, type yes.
$ scp ~/.ssh/id_dsa.pub USERNAME@USERNAME.backupbus.com:server1.key
Remember to replace USERNAME with your username.

Step 4


Add the key to the authorized keys list for your username on BackupBus.com
$ ssh USERNAME@USERNAME.backupbus.com "cat server1.key >> .ssh/authorized_keys"
Remember to replace USERNAME with your username.

Step 5


Optionally remove the key file on the BackupBus.com server.
$ ssh USERNAME@USERNAME.backupbus.com "rm server1.key"
If you finished the above steps correctly, then this step should not ask for a password.