Sponsored Link

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.
[1] Install SSHPass.
# install from EPEL

[root@dlp ~]#
dnf --enablerepo=epel -y install sshpass
[2] How to use SSHPass.
# [-p password] : from argument

[rocky@dlp ~]$
sshpass -p password ssh hostname
# [-f file] : from file

[rocky@dlp ~]$
echo 'password' > sshpass.txt

[rocky@dlp ~]$
chmod 600 sshpass.txt

[rocky@dlp ~]$
sshpass -f sshpass.txt ssh hostname
# [-e] : from environment variable

[rocky@dlp ~]$
export SSHPASS=password

[rocky@dlp ~]$
sshpass -e ssh hostname
Matched Content