实现方式:

通过expect工具实现

linux脚本实现scp命令自动输入密码和yes/no等确认信息

#!/bin/bash
yum -y install expect
expect -c "
spawn scp -r root@192.168.10.106:/root/qumf/Agoly.txt /root/qumf/
expect {
    \"*assword\" 
                {
                    set timeout 300; 
                    send \"Hhly2017\r\";
                }
    \"yes/no\" 
                {
                    send \"yes\r\"; exp_continue;}
                }
expect eof"

 

相关文章:

  • 2022-12-23
  • 2023-02-20
  • 2021-08-07
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-11
  • 2023-03-17
  • 2021-08-18
  • 2022-02-10
  • 2022-12-23
相关资源
相似解决方案