期望脚本不提示输入SFTP

时间:2018-11-30 14:39:55

标签: bash sftp expect

我想知道这里可能有什么问题

我执行了一个sftp期望脚本,该脚本会提示我输入密码,但似乎从未发送过密码。或者,如果确实以加密方式发送了密码,我们仍然不会进入sftp提示符。有什么想法吗?

cd /proj/eiffel004_config_fem107/slaves/RHEL6.4_GE_3/workspace/Remote_Agent_Test/
/usr/bin/expect << 'EOF' 
set timeout -1
spawn sftp root@server
expect { 
            "*assword: " 
       }
send "thePassword \r"
expect { 
            "sftp>  " 
       }
send "put filename \r"
expect { 
            "100" 
       }
send "exit \r"       
EOF    

输出为

+ cd /proj/eiffel004_config_fem107/slaves/RHEL6.4_GE_3/workspace/Remote_Agent_Test/
+ /usr/bin/expect
spawn sftp root@server
Connecting to server...
Warning: Permanently added 'server,102.44.79.32' (RSA) to the list of known 
hosts.

root@server's password: 

0 个答案:

没有答案