ssh to remote host without providing password

Lets say you are logged into Server-1 as User-1 and would like to ssh into Server-2 as User-2. Every time you ssh into Server-2 as User-2 you are prompted for a password. In order to automate file sharing and remote tunnels between the two servers – it is essential to establish a trust relationship between the two users across the serves.

I liked this post where it explains how to get this done:

The idea is to create a public-private key pair on Server-1 as User-1. Keep the private key in your user/.ssh directory and plan the public key on Server-2 under User-2’s home/.ssh/authorized_keys file. This should resolve the issue.

PS: Make sure that appropriate permissions are set on user directories. The .ssh directory must only have permissions for self. The authorized_keys file should only have rw permissions. The user home directory must not have write access by others (755).

1. chmod 700 ~/.ssh
2. chmod 600 ~/.ssh/authorized_keys
3. chmod 755 ~


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s