ssh自动输入密码

#!/usr/bin/expect

set timeout 2
spawn ssh -p [lindex $argv 0] [lindex $argv 1]@[lindex $argv 2]
expect {
        "(yes/no)?"
        {send "yes\n";exp_continue}
        "password:"
        {send "[lindex $argv 3]\n"}
}
interact

 

posted @ 2018-03-18 14:44  数字安全极客  阅读(256)  评论(0编辑  收藏  举报