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