Home > Unix/Linux > Passwordless SSH login

Passwordless SSH login

Many times requirement comes from development team that they need to login to remote server for some activity – be it ‘ftp’ or ‘copy’ or ‘writing’ on the remote server. In such cases, it is required that there is seamless and password less login from source server to target server.

I am going to discuss the way to achieve the same…
First of all be clear on

  1. what is the user on source server. say e.g. on application tier it is ‘applmgr’ and source server is A
  2. what is the user on target server – user could be same of different on target server. For my case, i would consider it to be different i.e. ‘wlshop’ and server is B

Step 1: Login to source server A using ‘applmgr’ user

Step 2: Generate public/private key pair using ssh-keygen command. This will prompt you to save the key in the default directory (/home/applmgr/.ssh/id_rsa). It will ask yo put the passsphrase. You may or may not enter the same

Step 3: Now the identification key is saved in /home/applmgr/.ssh/id_rsa and public key is saved in /home/applmgr/.ssh/id_rsa.pub

Step 4: Login to target server B using ‘wlshop’ user and create .ssh directory if not already present

Step 5: applmgr.A> cat .ssh/id_rsa.pub | ssh wlshop@B ‘cat >> .ssh/authorized_keys’. It will ask for wlshop@B password. 

Step 6: Now you can login to B as ‘wlshop’ from server A without being prompted for password

applmgr.A> ssh wlshop@B

 -Anand

 

Advertisements
Categories: Unix/Linux
  1. No comments yet.
  1. No trackbacks yet.

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

%d bloggers like this: