Often times you have automated scripts that require access to multiple machines from a single source and need to do so without having to deal with ssh password prompts. And in other instances you may have a bastian host (strong point) security model which you would like to have passwordless communication from. Below are 10 steps to setting up passwordless authentication with SSH in Linux.
(*note server1 is the source server and server2 will be the destination server)
server1# mkdir ~/.ssh
server1# cd ~/.ssh
server1# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (“your_local_home”/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
server1# scp ~/.ssh/id_rsa.pub email@example.com:/home/phil/id_rsa.server1.pub
server1# ssh firstname.lastname@example.org Password:
server2# mkdir .ssh
server2# chmod 700 .ssh
server2# cat id_rsa.server1.pub >> .ssh/authorized_keys
server2# chmod 644 .ssh/authorized_keys
server2# exit server1# ssh email@example.com
*Note repeat steps 4-10 for all target servers you would like passwordless access from server1
* FYI Ensure your /home/user directory has the permission 755 also!
You should be all set!