Sshpass command in Linux: non-interactive SSH password verification

Source: Internet
Author: User
Tags ssh

SSH login cannot specify a password on the command line. The emergence of Sshpass solves this problem. Sshpass for non-interactive SSH password authentication, generally used in the sh script, no need to enter the password again.

It allows you to specify a plaintext password with the-p parameter, and then directly log on to the remote server, which supports the password reading from the command line, file, and environment variables.

It is not installed by default and requires manual installation, as follows:

Sshpass Download Address: http://sourceforge.net/projects/sshpass/Download as a tar.gz compression package.

$ TAR-ZXVF sshpass-1.05.tar.gz

$ CD sshpass-1.05

$./configure--prefix=/opt/sshpass #指定安装目录

$ make

$ make Install

$ cp/opt/sshpass/bin/sshpass/usr/bin/

After the above steps, the Sshpass installation completes, the input command sshpass such as appears as follows prompts namely installs successfully:

Specify a password #从命令行方式传递密码-p

$ Sshpass-p ' 123456 ' ssh user_name@host_ip

$ Sshpass-p ' 123456 ' SCP root@host_ip:/home/test/t./tmp/

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.