Posted by: ibmadmin | April 12, 2011

SSH Login Without Password

SSH Login Without Password

In day today middleware administration, we may need to run many automated scripts from one UNIX servers to another UNIX servers. In this case, we need to SSH to another server without password to run the scripts. You can following the below steps to configure the SSH from server ONE (user1) to server TWO(user2).

We need to have access to server ONE and  server TWO to generate the SSH key and move the SSH public key to the server TWO.



1. First login into the server ONE.

ONE@user1$ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user1/.ssh/id_rsa):
Created directory ‘/home/user1/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user1/.ssh/id_rsa.
Your public key has been saved in /home/user1/.ssh/
The key fingerprint is:
32:4f:05:72:3a:2f:96:7c:3b:ad:af:58:37:bc:37:e4 a@A

We should not give any password during the “Enter passphrase” prompt. If you given any password, then you may need to use the same password during your ssh process.

2. Once you have completed the “ssh-keygen -t rsa” command execution, the respective user’s ssh private and public keys are stored in /home/user1/.ssh/ directory.

3. Take the /home/user1/.ssh/ user1 public key from the server ONE and copy the file into server TWO /home/user2/.ssh directory path to append the file content into the server TWO user2 profile authorized_keys file.

ssh user2@TWO
password for Server TWO – user2:

TWO@user2$cd /home/user2/.ssh
‘cat >> .ssh/authorized_keys’

4. Once the key has been placed in server TWO – user2 profile ssh directory, we are ready to do ssh from server ONE with out any password. (Note: You should used no password in step1.)

ONE@user1$ssh user2@TWO “/opt/was61/Websphere/AppSvr/profiles/Dmgr01/”

This will start the deployment manager in the Server TWO from the Server ONE terminal. Using this option, we can easily schedule the required jobs from server ONE.


#This script is used to move the web content from application server to webserver
cd /opt/IBM/WebSphere/AppServer/profiles/Profile01/installedApps/myappserverCell01/test.ear/myweb.war
tar -cvf myweb.tar web

#Moving the static contents to web server
scp myweb.tar webuser@mywebserver:/opt/IBM/ihs/
ssh webuser@mywebserver ‘cd /opt/IBM/ihs/;tar -xvf myweb.tar;’
ssh webuser@mywebserver ‘cd /opt/IBM/ihs/;./stop;sleep 3;./start;’

The above script we can run it from application server to control the web server content refresh and web server start and stop operation with out login into the web server. Please note that, we need to move the app server ssh public key to the web server authorized_keys file before we run this script. Else we might be prompted to enter password for each run.


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 )

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: