使用bash脚本中的Expect为SSH命令提供密码
对于那些想回复我应该使用SSH键的人,请弃权。
#!/bin/bashread -s PWD/usr/bin/expect <<EOD spawn ssh -oStrictHostKeyChecking=no -oCheckHostIP=no usr@$myhost.example.com' expect "password" send "$PWD\n" EOD echo "you're out"
spawn ssh -oStrictHostKeyChecking=no -oCheckHostIP=no usr@$myhost.example.com usr@$myhost.example.com's password: you're out
慕斯王
12345678_0001
慕码人8056858