Avoid ssh session time out

时光毁灭记忆、已成空白 提交于 2019-12-10 11:28:59

问题


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

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] 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.


回答1:


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-to-keep-alive

Add to ~/.ssh/config

ServerAliveInterval 30

or start your ssh session using:

ssh -o ServerAliveInterval 30 username@hostname

And BTW: the answer is not specific to Mac.




回答2:


You might consider using vi or more to edit a file.



来源:https://stackoverflow.com/questions/6373594/avoid-ssh-session-time-out

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!