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 node01.srv.world hostname node01.srv.world # [-f file] : from file [alma@dlp ~]$ echo 'password' > sshpass.txt [alma@dlp ~]$ chmod 600 sshpass.txt [alma@dlp ~]$ sshpass -f sshpass.txt ssh node01.srv.world hostname node01.srv.world # [-e] : from environment variable [alma@dlp ~]$ export SSHPASS=password [alma@dlp ~]$ sshpass -e ssh node01.srv.world hostname node01.srv.world |
Sponsored Link |