Generate your SSH key:

$ ssh-keygen -t rsa

Copy over to destination host:

$ scp ~/.ssh/id_rsa.pub user@host:~/.ssh

Login to remote host (still using password):

$ ssh user@host
user@host's password:
$ cd ~/.ssh
$ cat ./id_rsa.pub >> ./authorized_keys
$ rm -f ./id_rsa.pub
$ chown 600 ./authorized_keys

Logout and try login again:

$ ssh user@host
Enter passphrase for key '/home/localusr/.ssh/id_rsa':

That’s it. Enter the passphrase and you can login using your key.

Resources

SSH Login Using Keys

Leave a Reply

Your email address will not be published.