Keeping SSH Sessions Alive

A few days ago I left a procedure running on a HP-UX server through a connection in my Ubuntu laptop. The idea of having this servers is that you can go home, have some sleep and it will be working for you through the night, but to my surprise, the next day I came into the office I saw some absurd message that my connection was closed.

Update: I understand now that a better solution is to leave a process running on the background and piping it’s output to a file if needed, or using a multiplexer like tmux and simply attach to the running session on the server.

At first I thought the problem was on the server but when I run this procedure on a Windows box through putty it didn’t died on me. So i figured out it must be some kind of configuration on my computer. I understand this can be good as for security measures but in this case I need not to worry, we work through a very safe VPN.

So if you are experiencing the same problem all you need to do is go to

/etc/ssh/ssh_config

and add the following statement

ServerAliveInterval 300

Here is the site I took it from, it gives a more detailed explanation on what this does to your SSH connections.

Leave a Comment

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *