How to keep ssh session alive longer
- More often
sshtimes out when the user is not using the terminal for a few minutes. - The remote server disconnects the silent clients; Annoying!
- Two ways to resolve from client-side on Linux Mint/Ubuntu/Any
Way 1 (works great!)
- while connecting via ssh add few flags
ssh -o ServerAliveInterval=60 <myname>@<myremote-host-or-ip-address>
Way 2
-
nano $HOME/.ssh/configHost * ServerAliveInterval 240 - chmod 600 $HOME/.ssh/config
Alias ssh - Way 1
- In
~/.bashrc, towards the end
alias sshlive='ssh -o ServerAliveInterval=60'
- Open a new terminal or run
source ~/.bashrc - See, list of aliases that are set. Type
alias - Next time, when I want ssh we need not remember the long command.
- Just type
sshlive user@hostname. - Thanks to
alias
Thanks
Cheers and thanks to SO!