SSH自动重连工具-Autossh
2013-04-16 11:06:14 阿炯

autossh - Automatically restart SSH sessions and tunnels

Autossh is a program to start a copy of SSH and monitor it, restarting it as necessary should it die or stop passing traffic. The original idea and the mechanism were inspired by RSTunnel (Reliable SSH Tunnel).

With version 1.2 the method changed: autossh began to use SSH to construct a loop of SSH forwardings (one from the local machine to the remote, and one from the remote to the local), and then send test data that it expects to get back. (The idea was thanks to Terrence Martin)

autossh 是一个用来启动 ssh 并进行监控的程序,可在需要时重启 ssh,例如程序挂掉或者是网络出现问题。其灵感和机制来自于 rstunnel (Reliable SSH Tunnel). autossh 1.2 的方法已经改变:autossh 使用 ssh 来构造一个 ssh 重定向循环(本地到远程和远程到本地),然后发送测试数据并获得返回结果。

With version 1.3, a new method was added (thanks to Ron Yorston): a port may be specified for a remote echo service that will echo back the test data. This avoids the congestion and the aggravation of making sure all the port numbers on the remote machine do not collide. The loop-of-forwardings method remains available for situations where using an echo service may not be possible.

autossh 1.3 增加了一个新的方法:可指定远程 echo 服务的端口用于返回测试数据发送结果。这个避免握手阶段以及所有远程机器端口的冲突问题。而老的 loop-of-forwardings 方法依然可用。


Features
autossh is a program to start a copy of ssh and monitor it, restarting it as necessary should it die or stop passing traffic. The idea is from rstunnel (Reliable SSH Tunnel), but implemented in C.
 The author's view is that it is not as fiddly as rstunnel to get to work.
 Connection monitoring using a loop of port forwardings or a remote echo service.
 Backs off on rate of connection attempts when experiencing rapid failures such as connection refused.
 Compiled and tested on OpenBSD, Linux, Solaris, Mac OS X, Cygwin, and AIX; should work on other BSDs.
 Freeware.
 
最新版本:1.4
Disables the "gatetime" behaviour when -f is used, updates the list of OpenSSH options it knows about, and adds some fixes to configure.

项目主页:http://www.harding.motd.ca/autossh/