Passwordless login : ssh

SSH password less login

Its very much helpful for running automated scripts to communicate between two servers.  For example backup to remote server .Its very powerful but very easy to configure .

Local #  ssh-keygen  -t  rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/admin/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/admin/.ssh/id_rsa.
Your public key has been saved in /home/admin/.ssh/

If you accept the defaults you’ll have a pair of files created, as shown above, with no passphrase. This means that the key files can be used as they are, without being “unlocked” with a password first. If you’re wishing to automate things this is what you want.

Now that you have a pair of keyfiles generated, or pre-existing, you need to append the contents of the .pub file to the correct location on the remote server.
Assuming that you wish to login to the machine called from your current host with the id_rsa and files you’ve just generated you should run the following command:
#  scp  /home/admin/.ssh/   [email protected]:/root/.ssh/authorised_keys

# Try to login/using ssh commands remotely

ssh uptime

If you are getting correct result then you have successfully configured password less login.