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

[cent@dlp ~]$ sshpass -p password ssh node01.srv.world hostname

node01.srv.world

# [-f file] : from file

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

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

[cent@dlp ~]$ sshpass -f sshpass.txt ssh node01.srv.world hostname

node01.srv.world

# [-e] : from environment variable

[cent@dlp ~]$ export SSHPASS=password

[cent@dlp ~]$ sshpass -e ssh node01.srv.world hostname

node01.srv.world

Comments

Popular posts from this blog

Java : Variables Declaring

Install DNF in RHEL/CentOS 7

SQL Self JOIN