保持ssh连接live

当ssh session长时间处于空闲时,NAT防火墙可能会自动将连接清理掉,为避免这种情况,我们可以定时发送呼吸指令保持连接状态。

On Linux 或者 Mac Os:

可以选择全局设置,用户级别设置,分别为:/etc/ssh/ssh_config和~/.ssh/config(若不存在则创建一个),编辑:

Host *
    ServerAliveInterval 300
    ServerAliveCountMax 2

其中,ServerAliveCountMax是每次激活最大次数,ServerAliveInterval是激活时间单位为秒。

猜你喜欢

转载自blog.csdn.net/hongxingabc/article/details/82533398
今日推荐