You cannot specify a password in the Command Line for ssh login. The emergence of sshpass solves this problem. Sshpass is used for non-interactive SSH password verification. it is generally used in sh scripts and no need
You cannot specify a password in the Command Line for ssh login. The emergence of sshpass solves this problem. Sshpass is used for non-interactive SSH password verification. it is generally used in sh scripts and does not need to be entered again.
It allows you to use the-p parameter to specify the plaintext password and then directly log on to the remote server. it supports reading the password from command lines, files, and environment variables.
It is not installed by default and must be manually installed as follows:
Sshpass: the http://sourceforge.net/projects/sshpass/ is downloaded as a tar.gz compressed package.
$ Tar zxvf sshpass-1.05.tar.gz
$ Sshpass-1.05 cd
$./Configure -- prefix =/opt/sshpass # specify the installation directory
$ Make
$ Make install
$ Cp/opt/sshpass/bin/sshpass/usr/bin/
After the above steps, the sshpass installation is complete. if you enter the command sshpass, the installation is successful if the following prompt appears:
# Pass the password-p from the command line to specify the password
$ Sshpass-p '000000' ssh user_name @ host_ip
$ Sshpass-p '000000' scp root @ host_ip:/home/test/t./tmp/