Tuesday, 16 December 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 http://dl.fedoraproject.org/pub/epel/6/x86_64/sshpass-1.05-1.el6.x86_64.rpm
# 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 ‘leo$123′ ssh root@
If we want to run any command on other server from one server to prevent log on to other server.
ssh root@ “netstat -tunlp”
Prompts for password
With password in a single command:
sshpass -p ‘leo$123′ ssh root@ “netstat -tunlp”

1 comment: