ssh自动登入

公司的服务器在国外,所以测试的查看日志的时候需要测试机,然后继续ssh

非常不方便,所以编写一个简单的ssh登入脚本

#!/usr/bin/expect
set timeout 3
spawn ssh name@ip
expect "*password*"
send "passwd\r"
send "cd 目录\r"
interact

chmod +777  *.sh

执行以后发现,服务器上没有装expect  

汗!

猜你喜欢

转载自www.cnblogs.com/lizzzzz/p/9160893.html