AlmaLinux 9
Sponsored Link

OpenSSH : Use SSHPass2023/02/20

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

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

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

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

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

[alma@dlp ~]$
export SSHPASS=password

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