How to disable SSH timeout

Inactiveor idle SSH connections are normally disconnected by the server after a certainperiod of time. This depends on how the SSH server is configured, and upondisconnection the SSH client will be prompted with a message similar to thefollowing;

Read from remote host oseems.com:Connection reset by peer
Connection to oseems.com closed.

Thiscould be avoided by changing the SSH server's configuration, or tricking theserver from the client's end.

SSHClient

This is probably the easiest method as it doesn'trequire root or administrator access tothe server and it could be applied to all SSH connections instead of just to aspecific server.

What's going to happen is to basically keep theconnection active even if the user is actually idle. This could be done byusing the ServerAliveInterval option where the SSH clientwill send a null packet to the server over a set period of time just to keepthe connection alive.

Thefollowing option will send the packet every 100 seconds;

ServerAliveInterval 100

In Linux this could be set globally in /etc/ssh/ssh_config or per-user in ~/.ssh/config. It could also be used inthe command line as an argument as in the following example;

ssh -o ServerAliveInterval=100user@example.com

SSHserver

Withadministrator / root access, the option could just be disabled in the server.Set the related options in the global SSHd configuration file as the following,and restart the SSHd service.

ClientAliveInterval 30
TCPKeepAlive yes
ClientAliveCountMax 99999

In Linux, /etc/ssh/sshd_config normally is theconfiguration file and the service could usually be restarted by the followingcommand;

sudo service sshd restart

- See more at: https://docs.oseems.com/general/application/ssh/disable-timeout#sthash.QmMhAOmN.dpuf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值