利用shell脚本通过ssh绕过输入密码直接登录主机

shell

#!/usr/bin/expect
spawn ssh root@192.168.137.141
expect "*password:"
send "lizhenghua\r"
expect "*#"
interact

需要安装expect, 如果执行失败

yum install expect -y
posted @ 2018-05-11 15:35  扶苏公子x  阅读(5171)  评论(0编辑  收藏  举报