How to Setup SSH Password Less in UNIX

Let us say, there are two servers, server-A and server-B. The objective is to setup password less from server-A toward server-B using RSA Key.

Here are step by step to follow:

Step#1: Create .ssh directory in server-A if it’s not exist.

server-A# mkdir ~/.ssh

Step#2: Go to inside .ssh directory

server-A# cd ~/.ssh

Step#3: Generate both RSA private and public keys

server-A# ssh-keygen -t rsa

Step#4: Transfer generated RSA public key from server-A to server-B

server-A# scp ~/.ssh/id_rsa.pub <server-B>:/<home>/id_rsa.server-A.pub

Step#5: Go to server-B

server-A# ssh <server-B>
Password:

Step#6: Create .ssh directory in server-B if it’s not exist.

server-B# mkdir .ssh

Step#7: Change directory permission to be readable, writable and executable by the owner

server-B# chmod 700 .ssh

Step#8: Append transferred RSA public key of server-A to authorized_keys file inside .ssh directory of server-B

server-B# cat id_rsa.server-A.pub >> .ssh/authorized_keys

Step#9: Change authorized_keys file as following

server-B# chmod 644 .ssh/authorized_keys

Step#10: Logoff from server-A and test RSA password less setup from server-A toward server-B

server-B# exit
server-A# ssh <server-B>

Note:

1- Above steps were tried between two Unix Solaris based Servers.

2- If DSA Key is preferred, just replace ‘rsa’ with ‘dsa’ in above steps

Advertisements

1 thought on “How to Setup SSH Password Less in UNIX”

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s