0845680984

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.

# install from EPEL
[root@localhost ~]# yum --enablerepo=epel -y install sshpass

[2] How to use SSHPass.

# -p password : from argument
[root@localhost ~]$ sshpass -p password ssh 10.0.0.51 hostname
node01.local
# -f file : from file
[root@localhost ~]$ echo 'password' > sshpass.txt
[root@localhost ~]$ chmod 600 sshpass.txt
[root@localhost ~]$ sshpass -f sshpass.txt ssh 10.0.0.51 hostname
node01.local
# -e : from env variable
[root@localhost ~]$ export SSHPASS=password
[root@localhost ~]$ sshpass -e ssh 10.0.0.51 hostname
node01.local

Leave a Comment

Your email address will not be published. Required fields are marked *

Bài viết gần đây:

Shopping Cart