CentOS 7
Sponsored Link

Use SSHPass
2015/04/15
 
Use SSHPass to automate inputting password on password authentication.
This is convenient but has security risks (leak of password), take special care if you use it.
[1] Install SSHPass.
# install from EPEL

[[email protected] ~]#
yum --enablerepo=epel -y install sshpass
[2] How to use SSHPass.
# -p password : from argument

[[email protected] ~]$
sshpass -p password ssh 10.0.0.51 hostname

node01.srv.world
# -f file : from file

[[email protected] ~]$
echo 'password' > sshpass.txt

[[email protected] ~]$
chmod 600 sshpass.txt

[[email protected] ~]$
sshpass -f sshpass.txt ssh 10.0.0.51 hostname

node01.srv.world
# -e : from env variable

[[email protected] ~]$
export SSHPASS=password

[[email protected] ~]$
sshpass -e ssh 10.0.0.51 hostname

node01.srv.world