SSH login without password

SSH login without password or Keybased Authentication 

password less ssh 

Problem : SSH login without password 

You want to use Linux and OpenSSH to automate your tasks. Therefore you need an automatic login

from host A( user "tom"  --> to Host B (  user "jim".

You don't want to enter any passwords, because you want to call ssh from a within a shell script.

Solution : How to do it

First log in on A as user tom and generate a pair of authentication keys. Do not enter a passphrase:> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/tom/.ssh/id_rsa):
Created directory '/home/tom/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/tom/.ssh/id_rsa.
Your public key has been saved in /home/tom/.ssh/
The key fingerprint is:

Now use ssh to create a directory ~/.ssh as user jim on (The directory may already exist, which is fine):> ssh mkdir -p .ssh's password:

Finally append tom's new public key to and enter jim's password one last time:> cat .ssh/ | ssh 'cat >> .ssh/authorized_keys''s password:

From now on you can log into B as jim from A as a without password:> ssh>

A note from one of our readers: Depending on your version of SSH you might also have to do the following changes:
Put the public key in .ssh/authorized_keys2

Change the permissions of .ssh to 700
Change the permissions of .ssh/authorized_keys2 to 640