SSH自动登录脚本

原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/11926792.html

vi app-stg.sh

1 #!/usr/bin/expect -f
2 #auto ssh login
3 set timeout 30
4 spawn ssh hatianqi@181.171.161.10
5 expect "password:"
6 send "12345678
"
7 interact

wq后

1 chmod 744 app-stg.sh

cd到脚本所在的目录,登录

1 ./app-stg.sh
原文地址:https://www.cnblogs.com/agilestyle/p/11926792.html