When I login to a remote machine via ssh, I have to enter a password first and then login to the OS itself by entering another pair of login and a password. When I'm doing I type exist. However, it doesn't terminate the ssh session, instead if logs me out from the OS:

[machine_name@login123 folder_name]$ exit

CentOS release 6.2 (Final)
Kernel 3.14.5-x86-linode61 on an i686

machine_name login:

How do I disconnect from the ssh session?

  • 1
    This is for some kind of remote console / out-of-band management rather than a direct connection to the machine, right? When you ssh directly to the machine I can't imagine this happens? – Håkan Lindqvist Oct 27 '14 at 6:33
  • What command did you use to make the initial connection? – Andrew Schulman Oct 27 '14 at 8:11
  • @AndrewSchulman, ssh. – Oskar K. Oct 27 '14 at 16:55
  • @HåkanLindqvist, it's ssh. – Oskar K. Oct 27 '14 at 16:56
  • What output do you get from the tty and who am i commands? This isn't behaving like a normal ssh session. That output might clarify thimgs. – Paul Haldane Oct 27 '14 at 23:23

That's not typical ssh behavior. It sounds like the remote server has been configured in some unusual way. In any event, when ssh is running interactively, it accepts a set of escape sequences to invoke special behavior. One of these escape sequences will cause ssh to disconnect and exit.

To disconnect, type <CR>~.. That means to press your return key (aka the enter key), then tilde (~), then period.

There are other sequences you can type. typing <CR>~? (return, tilde, question-mark) will print a list. You can also see a list by viewing the ssh man page and searching for "ESCAPE CHARACTERS".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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