1.做一個auto_ssh.exp
#!/usr/bin/expect
set timeout 30
spawn ssh [lindex $argv 0]@[lindex $argv 1]
expect {
"(yes/no)?"
{send "yes\n";exp_continue}
"password:"
{send "[lindex $argv 2]\n"}
}
interact
2.把腳本拷貝到/usr/local/bin下
3.像圖中一樣設置
ok了。