How to do SSH key authentication

Published: 23-Jan-2011 (22:30); Viewed: 1879; Difficulty: 1 out of 10

Rating: N/A

RSA key-based authentication is one of the simplest and most secure way to login from Unix computer to remote Unix based computer. You need to enter secret pass-phrase only once, and then you can login (ssh), copy (scp) or synchronize files (rsync) without entering password or secret pass-phrase.

step-by-step instructions

Create set of RSA keys which will be used for authentication We recommend to use very strong security level:

ssh-keygen -t rsa -b 4096

Answer by default to all questions, but please enter very long and secure pass-phrase, which you should remember very well.
Generating public/private rsa key pair will be as follow:

Enter file in which to save the key (/home/yourname/.ssh/id_rsa):
Enter pass-phrase (empty for no pass-phrase):
Enter same pass-phrase again:
Your identification has been saved in /home/yourname/.ssh/id_rsa.
Your public key has been saved in /home/yourname/.ssh/id_rsa.pub.