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've got a weird issue. Every time I hit Ctrl+D or use logout or exit, I see

Connection to remote.host.com closed

and then I am immediately logged back in:

Last login: Thu Oct 6 21:04:20 2011 from xyz
user@remote.host.com ~ $ 

Why is this happening and how can I make it stop?

share|improve this question
Give some details about your setup. At least the system and command with which you connect. If it is just ssh user@hostname, then what is the output of type ssh? – rozcietrzewiacz Oct 7 '11 at 14:02
up vote 2 down vote accepted

Look for the option that says "re-connect if disconnected" in your SSH client. If you're using the command-line client, check to see if it's not running something like function ssh() { while true; ssh "$@"; done; }

share|improve this answer
That was it. I forgot about the loop I wrote since I was initially having connection issues. – Naftuli Tzvi Kay Oct 7 '11 at 23:45

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.