Debian 10 Buster
Sponsored Link

OpenSSH : Use SSHPass2019/07/10

 
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.
root@dlp:~#
apt -y install sshpass
[2] How to use SSHPass.
# -p password : from argument

# if initial connection, specify [StrictHostKeyChecking=no]

debian@dlp:~$
sshpass -p password ssh -o StrictHostKeyChecking=no 10.0.0.51 hostname

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

debian@dlp:~$
echo 'password' > sshpass.txt

debian@dlp:~$
chmod 600 sshpass.txt

debian@dlp:~$
sshpass -f sshpass.txt ssh 10.0.0.51 hostname

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

debian@dlp:~$
export SSHPASS=password

debian@dlp:~$
sshpass -e ssh 10.0.0.51 hostname

node01.srv.world
Matched Content