存档

文章标签 ‘expect’

shell脚本实现ssh自动登陆

2013年4月2日 没有评论

必要软件包:expect
ssh连接远程主机时候会询问密码,跟su、sudo命令的默认行为一样,是不从stdin读入数据的,传说是为安全考虑,但是有时候在脚本当中确实需要无人守值的登陆。
搜索一下不难找到类似的例子,使用expect来完成密码应答:

#!/bin/bash
auto_lo[......]<p class="read-more"><a href="https://www.fengdingbo.com/shell-auto-login-ssh.html">Read more</a></p>
分类: Linux 标签: ,