在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
特别感谢阿干同学的邮件分享。 详细方法 复制代码 代码如下:Linux/mac下,在$HOME/.ssh/config中加入 Host * ControlMaster auto ControlPath <a>/tmp/ssh-%r@%h</a> 至此只要第一次SSH登录输入密码,之后同个Hosts则免登。 配置文件分析 man ssh_config 5 复制代码 代码如下:ControlPath Specify the path to the control socket used for connection sharing as described in the ControlMaster section above or the string “none” to disable connection sharing. In the path, ‘%l’ will be substituted by the local host name, ‘%h’ will be substituted by the target host name, ‘%p’ the port, and ‘%r’ by the remote login username. It is recommended that any ControlPath used for opportunistic connection sharing include at least %h, %p, and %r. This ensures that shared connections are uniquely identified. %r 为远程机器的登录名 原理分析 严格地讲,它并不是真正意义上的Session Copy,而只能说是共享Socket。 可以通过ssh -v参数,看debug信息验证以上过程 备注 有同学说在linux上通过证书的形式,可以实现免登录,没错。 |
请发表评论