ssh自动输入密码
2022-02-15 本文已影响0人
下鱼塘
- 新建脚本,保存。
#!/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