Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm curious as to why my reverse SSH tunnel closes after a certain amount of time has passed while being inactive. Is this related to the specific ISP? I'm trying to reverse tunnel into a virtual linux box. I can connect remotely after killing the PID and then restarting autossh. This only works for about 10 minutes though.

I'd really appreciate any help!


share|improve this question

Make sure the following are set in your sshd_config file on the machine you are tunnelling to:

TCPKeepAlive yes
ClientAliveInterval 30
ClientAliveCountMax 9999

These settings will make sure your connection is kept alive even when inactive.

share|improve this answer

Normally I don't answer a question with just a link. This episode of Hak5 explains reverse tunnels and addresses specifically why a reverse tunnel gets shut off, and what to do about it.

share|improve this answer
I will be watching this tonight. Thank you very much. – Casey Aug 7 '12 at 23:36

A short timeout usually is related to some kind of time out set in a firewall or NAT device. The simple solution is just to pass the ssh option to set the ServerAliveInterval. Which just sends a periodic packet to keep the connection alive.

    ServerAliveInterval 60  # 60 seconds sounds good?

Then just connect with ssh

share|improve this answer
Thanks a lot! I did this along with 'ServerAliveCountMax #' where # is the amount of attempts to perform 'ServerAliveInterval' at which ever predetermined interval (in the example above, 60 seconds). – Casey Aug 7 '12 at 23:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.