Shell --- SCP remote file transfer requires no manual Password

Source: Internet
Author: User
1. sshpass enables SSH to remember the password for SSH Automatic Login (1) install sshpasssudo apt-Get install sshpass.pdf download sshpass-1.05.tar.gz shell> tar xvf sshpass-1.05.tar.gzshell> Cd sshpass-1.05shell> make & make install (2) test shell>/usr/local/bin/sshpass-P password SSH [email protected] (3) setting to avoid public key confirmation SSH will prompt public key confirmation at the first link, this will cause some automation tasks to fail. Shell> sudo Vim/etc/ssh/ssh_config # Add the following stricthostkeychecking no (4 ~ /Examples. Desktop is uploaded to 192.168.1.1 ~ Sshpass-P 123456 SCP ~ in the directory ~ /Examples. Desktop [email protected]: ~ 2. Use transport CT to transfer files (1) install expectsudo apt-Get install transport CT (2) Test the transfer of/home/test/soft.tar of 192.168.1.1 to/home/test # on the local machine #! /Usr/bin/empty CT-F # filename: scp_expect.shset password 123456 spawn SCP-R [email protected]: /home/test/soft.tar/home/testset timeout 3 expect CT {"yes/no" {send "Yes \ r "; exp_continue} set timeout 3 Send "$ password \ r" # set timeout 300 send "Exit \ r" required CT EOF


This article is from the "Notes" blog, please be sure to keep this source http://sunflower2.blog.51cto.com/8837503/1554419

Shell --- SCP remote file transfer requires no manual Password

Related Article

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.