Archive for May, 2014

sshpass command in linux

Posted: May 2, 2014 in Uncategorized

ssh login with password instead of waiting for password prompt:

Possible with sshpass.

Check if the server is installed with sshpass by running below command
which sshpass.
If no path found, then install with

#yum install sshpass

if no luck, then download rpm and install it.

sshpass rpm download link:

# wget

# rpm -ivh sshpass-1.05-1.el6.x86_64.rpm

# which sshpass


Now log onto server with password in single command which ignores user prompt for password

sshpass -p ‘password’ ssh root@IP

If we want to run any command on other server from one server to prevent log on to other server.

ssh root@IP “netstat -tunlp”
Prompts for password

With password in a single command:

sshpass -p ‘password’ ssh root@ip “netstat -tunlp”