- 新建脚本,保存。
#!/usr/bin/expect -f
set password "123456"
set timeout -1
spawn ssh user@xxx.xxx.xxx.xx
expect "*assword:*"
send "$password\r"
expect "Last*"
interact
- chomd +x 修改权限
- 执行即可
#!/usr/bin/expect -f
set password "123456"
set timeout -1
spawn ssh user@xxx.xxx.xxx.xx
expect "*assword:*"
send "$password\r"
expect "Last*"
interact
本文标题:ssh自动输入密码
本文链接:https://www.haomeiwen.com/subject/opcllrtx.html
网友评论