Shell example of skipping password authentication with expect

Source: Internet
Author: User

#!/bin/bashlocal_dir= '/tmp/test_huadan ' ip= ' 192.168.0.221 ' password= ' Lhm0125 ', des_dir= '/tmp/test_huadan ' list=$ ( Find $Local _dir-cmin-60) for i in $List do#echo $i if [-f $i] then expect << EOF #利用expect命令, catch Catch Password keyword, and then pass in the password, this case also applies to SSH and sftp spawn/usr/bin/scp $i $Ip: $Des _dir expect "Password:" Send "$Pass Word\r "Expect eofeof fi done


This article is from the "Python" blog, so be sure to keep this source http://9473814.blog.51cto.com/9463814/1652385

Shell example of skipping password authentication with expect

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.