避免SSH会话超时 [英] Avoid ssh session time out
问题描述
我正在远程服务器上工作,该服务器在闲置5分钟后自动将我注销.这是通常在执行此操作时提供的消息:
I am remotely working on a server that automatically logs me out after 5 minutes of inactivity. Here's the message that it usually provides when it does so:
Read from remote host XXXXXXX: Operation timed out
我通常会打开多个会话,大约每30分钟一班,所以我想知道如何做才能避免断开连接.我已经尝试过:
I typically have several sessions open, which I use at roughly 30-minute intervals, so I wonder what I could do to avoid getting disconnected. I've already tried:
- [a]在会议注销之前,请猴子去敲一些键
- [b]运行
top
命令 - [c]威胁服务器管理员:)
- [a] hiring a monkey to hit some keys before the session logs me out
- [b] running the
top
command - [c] threatening the server administrator :)
还有其他建议吗?谢谢.
Any other suggestions? Thanks.
推荐答案
已在StackOverFlow上得到解答-我在此处添加了链接,供那些不想在搜索此答案时去第三方论坛的人使用(就像我一样):
This has been answered on StackOverFlow - I add the link here for people that don't want to go to a third party forum when they search for this answer (as I did):
https://stackoverflow.com/questions/13390710/mac-terminals-how保持活力
添加到〜/.ssh/config
Add to ~/.ssh/config
ServerAliveInterval 30
或使用以下命令开始ssh会话:
or start your ssh session using:
ssh -o ServerAliveInterval 30 username@hostname
和顺便说一句:答案并非特定于Mac.
And BTW: the answer is not specific to Mac.
这篇关于避免SSH会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!