Avoid ssh session time out
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 t开发者_JAVA技巧o 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.
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.
You might consider using vi
or more
to edit a file.
精彩评论