自动登录远端机器shell脚本 CentOS7.4

原创
2017/11/06 14:08
阅读数 597

1.先安装expect:

yum install expect

2. 写个shell脚本SSHLoginRemote.sh :

#!/usr/bin/expect
spawn ssh root@192.168.4.2
expect "*password:"
send "sophnep!@#\r"    #user password
expect "*#"
interact

3.直接运行SSHLoginRemote.sh:

./SSHLoginRemote.sh

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部