ubuntu openssh 连接自动断开问题
2013-08-29 17:20
357 查看
How to disable SSH timeout
By default, most SSH servers are set to disconnect clients who has been inactive or idle after a certain period of time. You'll be prompted with message similar to the following upon disconnection;Read from remote host oseems.com: Connection reset by peer Connection to oseems.com closed.
To avoid being disconnected, you have the choice to either configure your SSH client, or the server itself if you have the required permission.
SSH Client
This method is the way to go if you have no administrator access to the server you are connecting to. This method will apply to all the servers you are connecting to, instead of only to a specific server.What you're basically to do is to configure your SSH client client to periodically send keep alive message to the SSH server. If you're running Ubuntu / Debian, edit
/etc/ssh/ssh_configand
set
ServerAliveIntervaloption to the following;
ServerAliveInterval 100
This option is to tell your SSH client to automatically send the keep alive message every 100 seconds to the SSH server, even if you're away from your client machine. The server will assume you're not idling and
will not disconnect your session.
SSH server
If you have administrator access to the server, you can configure the ClientAliveInterval,
TCPKeepAliveand
ClientAliveCountMaxoptions
in the SSHd configuration file. If you're running Ubuntu / Debian, the file's path is
/etc/ssh/sshd_config
ClientAliveInterval 30 TCPKeepAlive yes ClientAliveCountMax 99999
You will need to restart the SSH server for the changes to take effect.
sudo /etc/init.d/sshd restart
ClientAliveCountMax 次数我只写了1000,说是太大可能会导致服务器溢出。
相关文章推荐
- 解决数据库连接池连接mysql时,每隔8小时mysql自动断开所有连接的问题
- websocket自动断开连接问题
- 转: xshell远程连接自动断开的问题解决办法
- Secure CRT 连接自动断开的问题
- SecureCRT 自动断开连接的问题
- MySQL+Hibernate下连接空闲8小时自动断开问题解决方案
- xshell远程连接自动断开的问题解决办法
- mysql超时设置的问题,如果连接闲置8小时 (8小时内没有进行数据库操作), mysql就会自动断开连接, 要重启tomcat
- 解决LINUX(CENTOS)下SSH连接超时自动断开的问题
- MySQL dbcp 下连接空闲8小时自动断开问题解决方案
- mysql无法执行某些语句,并自动断开服务连接问题
- ssh连接Linux自动断开后再也无法连上的问题
- 关于mysql数据库8小时不进行操作连接自动断开问题的解决办法
- mysql workbench自动断开连接问题
- Springboot多数据源自动断开connection连接问题
- 解决数据库连接池连接mysql时,每隔8小时mysql自动断开所有连接的问题
- 解决mysql自动断开连接的问题
- SecureCRT自动断开连接的问题
- centOS ssh连接 一段时间无操作连接自动断开问题