Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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 have created a reverse ssh tunnel to connect to a computer behind NAT using:

ssh -R 9050:localhost:22 user@middleserver

in the destination system. I closed the terminal that I entered this command in. But I'm still able to connect to the destination computer using

ssh destuser@middleserver -p 9050 from my system

Is this normal?

share|improve this question
up vote 3 down vote accepted

Yes with OpenSSH, the ssh client won't terminate until all its open forwarded connections are all closed, in either direction. As long as any connection is open it will continue to accept new connections (which is at least surprising, and arguably a defect).

Use the sequence ~# after a CR and OpenSSH will show you which forwarded connections are open at that time. Use ~. to terminate ssh if it persists after logout/exit/^D due to open connections, this only applies if you start ssh yourself in a terminal emulator. If your GUI/WM environment starts ssh sessions for you, it may close windows even though there are processes still running.

share|improve this answer

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.