ssh连接超时解决方法如何设置ssh超时时间。这个应该是修改你服务器端根目录下的.bash_profile文件,添加exportTMOUT=1000000(单位秒)然后运行:source.bash_profilein/etc/ssh/sshd_config添加:ClientAliveInterval=60everyeveryminute,sshd问候ssh客户端,检查是否存在,不存在则断开连接。注意:设置完成后,需要退出ssh远程连接,重新登录才能生效。因为你必须再次阅读./bash_profile。为了方便起见,设置写成如下脚本:echoexportTMOUT=1000000>>/root/.bash_profilecat/root/.bash_profilesource.bash_profilecp/etc/ssh/sshd_config/etc/ssh/sshd_config_bakechoClientAliveInterval=60>>/etc/ssh/sshd_configservicesshdrestartcat/etc/ssh/sshd_configservicesshdrestartexit总结:在ClientAliveInterval(/etc/ssh/sshd_config)、环境变量TMOUT(在/etc/profile或.bash_profile中设置)和putty的"Secondsbetweenkeepalives"这几个方法其中检测到只有TMOUT可以控制ssh连接在空闲时间超时自动断开的时间,数值单位是“秒”。设置TMOUT(非0)后,其他两个变量将不起作用。更多信息:了解更多关于ssh_timeout_in_linux如何增加ssh超时时间增加linuxssh连接超时快速指南设置ssh密钥以无密码登录linux
