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\r"
7 interact

wq后

1 chmod 744 app-stg.sh

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

1 ./app-stg.sh

 

 

 

posted @ 2019-11-25 11:45  李白与酒  阅读(2221)  评论(0编辑  收藏  举报