Non interactive ,without typing password do ssh to Server : By sshpass
Most of the time I found that there is always a question How to do ssh to Server without typing the passwd.
I have one posted on bash scripting method with using expect command and there is one more method of passing RSA-DSA ssh keys by which you do not have to type password.
Here is one package called sshpass by which we can SSH to server without typing the password.
Below is the how to method.
I tested this in CentOS 5.6 ,I hope the package will be helpful in your linux Distro as well.
Step (1) Download the package from below given link (I have x86 Server) :
Step (2) install the package by below command:
rpm -ivh sshpass-1.05-1.el5.i386.rpm
Step (3) Use the command.
U can find manual page helpful so once do “man sshpass”
Here I will use file to pass my password in command it is scure rather than passing password in commandline.
create a file with name “mypass” and type the password of user from which U want to login.
and save it and close by :wq
Here is the command:
sshpass -f<filename> ssh username@ServerIP_Or_ServerName
sshpass -fmypass ssh username@ServerIP_Or_ServerName
Even U can do some more things like rsync and remote command execution.
sshpass -fmypass ssh username@ServerIP_Or_ServerName “ls -la”