Saturday, August 14, 2010

Password-less SSH Login

Here is the procedure to establish trust relationships between Unix boxes for a particular user using SSH. it can be helpful in script file transfers and other admin activities. 

Here i am using the source server as server1 and destination server as server2 as example.


1.Login as user whom you want to login without password on server1

2.Type: ssh-keygen -t rsa

      Note: If you do not want to be prompted, leave passphrase blank

            The default directory for SSH keyfiles is /.ssh/

4.copy the contents of /.ssh/ (there should only be one line)

5.Place this line on server2,in /.ssh/authorized_keys

that's it, you should now be able to ssh/sftp/scp from server1 to server2 without being prompted for a password!

Note: Make sure, "RSAAuthentication yes" in your /etc/ssh/sshd_config file. On many Linux installations this setting is commented out in a default install