The Computer Oracle

How do I exit an SSH connection?

--------------------------------------------------
Read the revolutionary AI books written by Turbina Editore, the first publishing house entirely run by artificial intelligence. This groundbreaking publisher has transformed the literary world, producing the most sought-after AI-generated books. Start reading today at:
https://turbinaeditore.com/en/
--------------------------------------------------

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT


Music by Eric Matyas
https://www.soundimage.org
Track title: A Thousand Exotic Places Looping v001

--

Chapters
00:00 How Do I Exit An Ssh Connection?
00:31 Answer 1 Score 34
00:43 Answer 2 Score 343
01:58 Answer 3 Score 13
02:08 Answer 4 Score 12
02:33 Thank you

--

Full question
https://superuser.com/questions/467398/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #ssh #virtualbox

#avk47



ANSWER 1

Score 343


Short answer: Type exit

If that doesn't work, however...

SSH Escape Character and Disconnect Sequence

Most SSH implementations implement an escape character for interactive sessions, similar to telnet's Ctrl-] combination. The default SSH escape character is ~, entered at the beginning of a line.

If you want to terminate an interactive OpenSSH session which is stuck and cannot be exited by entering exit or CtrlD into a shell on the remote side, you can enter ~ followed by a dot .. To be sure to enter the escape character at the beginning of an input line, you should press Enter first. So the following sequence will in most cases terminate an SSH session:

Enter~.

Other Escape Sequences

OpenSSH, for example, offers other escape sequences besides ~.. Entering ~? during a session should give you a list. Some examples:

  • ~ followed Ctrl-Z suspends the session,
  • ~& puts it directly into background,
  • ~# gives a list of forwarded connections in this session.
  • If you want to simply enter a tilde at the beginning of a line, you have to double it: ~~.

The escape character can be changed using the command line option -e. If you set the special value -e none, escaping is disabled and the session is fully transparent.

See also the OpenBSD man page on ssh (which is referenced from www.openssh.org) under the -e command line option




ANSWER 2

Score 34


Do you want to exit the SSH shell?

You can type exit and hit Enter, or use Ctrl+D




ANSWER 3

Score 13


Just type exit or logout (then hit Enter of course) both will work.




ANSWER 4

Score 12


These are the supported characters which provide various options with which you can play around with ssh.

Supported escape sequences:

 ~.  - terminate session

 ~B  - send a BREAK to the remote system

 ~R  - Request rekey (SSH protocol 2 only)

 ~#  - list forwarded connections

 ~?  - this message

 ~~  - send the escape character by typing it twice

(Note that escapes are recognized only immediately after a newline.) You can close the list of Escape sequences by hitting Enter.