Password Less authentication to Linux servers makes the system admin's life easy. To Implement password less or Keys based authentication we have to generate Public and Private keys , Copy the Pubic keys to remote Linux servers either manually or by ssh-copy-id command .
In My scenario I have Ubuntu laptop and daily I have to login to lot of remote Linux servers , Follow the below steps to achieve password less / Keys based authentication :
Step:1 Generate Public and Private keys , using below command
# ssh-keygen -t rsa
Above command will save the keys under ~/.ssh directory with the name id_rsa & id_rsa.pub. Leave the passpharse empty while executing above command.
Step:2 Copy the public key to remote linux servers
# ssh-copy-id -i /root/.ssh/id_rsa.pub email@example.com
ssh-copy-id command will automatically copy the contents of id_rsa.pub file to ~/.ssh/authorized_keys file of remote linux server
Note : if we don't want to use ssh-copy-id command , then manually Append contents of file "id_rsa.pub" to "~/.ssh/authorized_keys" remote linux server and change the permissions of "~/.ssh/authorized_keys" to 755.
Example:3 Now access the remote linux server and it will not ask for the password.