OpenSSH : Use SSHPass

Use SSHPass to automate inputting password on password authentication.
This is convenient but it has security risks (leak of password), take special care if you use it.

Install SSHPass.

root@dlp:~#  apt -y install sshpass

How to use SSHPass.

# [-p password] : from argument
# if initial connection, add [StrictHostKeyChecking=no]

ubuntu@# sshpass -p password ssh -o StrictHostKeyChecking=no 10.0.0.51 hostname
node01.srv.world

# [-f file] : from file

ubuntu@dlp:~$ echo ‘password’ > sshpass.txt
ubuntu@dlp:~$ chmod 600 sshpass.txt
ubuntu@dlp:~$ sshpass -f sshpass.txt ssh 10.0.0.51 hostname
node01.srv.world

# [-e] : from environment variable
ubuntu@dlp:~$ export SSHPASS=password
ubuntu@dlp:~$ sshpass -e ssh 10.0.0.51 hostname node01.srv.world