通过expect免自动输入密码登陆远程服务器

1、前提必须已经安装expect

2、新建login.sh,文件内容如下

#!/usr/bin/expect -f
spawn ssh root@140.10.10.52
expect "password:"
send "passwordR\r"
interact

 

3、执行./login.sh即可登陆远端服务器

相关文章:

  • 2021-04-05
  • 2021-05-06
  • 2021-11-27
  • 2021-07-20
  • 2022-12-23
  • 2021-10-29
  • 2021-08-10
  • 2021-12-25
猜你喜欢
  • 2022-12-23
  • 2022-01-21
  • 2022-01-04
  • 2021-12-02
  • 2022-01-18
  • 2022-12-23
  • 2021-07-24
相关资源
相似解决方案