用autossh保证ssh隧道稳定性
用autossh保证ssh隧道稳定性
用autossh保证ssh隧道稳定性
最近希望建立的ssh隧道可靠,有时候进程仍然在,但是连接已经无效。
autossh是个很好的东西。在Ubuntu下安装
apt-get install autossh
使用方法很简单,比如原来直接用ssh的命令:
[plain]
ssh -N -v -D localhost:8527 root@remote_ssh_server -p remote_ssh_port
现在改成:
[plain]
autossh -M 5122 -N -v -D localhost:8527 root@remote_ssh_server -p remote_ssh_port
试用后,的确效果很好。
-M 5122是服务器echo机制使用的端口。虽然不太明白用处,但是加上了也不影响工作。
评论暂时关闭