7

I often use Ubuntu's GNOME Terminal to connect to an external server using ssh. When rebooting the server the Terminal shows this message:

# reboot

Broadcast message from root (pts/0) (Wed Sep 29 13:52:26 2010):

The system is going down for reboot NOW!
# 

And a seconds later the Terminal no longer responds to keystrokes, CTRL-c, CTRL-d, etc... The only escape seems to be closing the Terminal window from the GUI.

Does anyone know of a more elegant way to break out of ssh after a remote server reboot?

4 Answers 4

12

Type

~. (tilde followed by dot)

and look for 'escape characters' in the man page of ssh.

1
  • In some terminals, (e.g.yakuake), you first have to hit the ENTER key and then ~.
    – rubo77
    Mar 20, 2021 at 8:20
2

Try using shutdown instead. It allows you to specify a time before the shutdown occurs. Gives you a chance to log out of the session:

sudo /sbin/shutdown -r 60 "System is rebooting in 60 seconds!"
0

Use the "exit" command.

Note:

$ ssh -V

OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009

0

This will schedule the shutdown a moment after (~ 0 seconds) you exit the ssh session.

 sudo shutdown --reboot 0 ; exit

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .