Send Ctrl-Alt-Del over SSH?
Solution 1
If you are connected to a serial console and your kernel has CONFIG_MAGIC_SYSRQ
and /proc/sys/kernel/sysrq
enabled (default on my Ubuntu machines), you can try BREAK, ALT-BREAK or CTRL-BREAK (depends on the SSH
to serial converter).
If that works, you can press h (within 5 seconds) to get a list of available commands ("s = sync filesystems
" and "b = force immediate reboot
" are maybe what you are looking for).
For more information, have a look at linux/Documentation/sysrq.txt
Solution 2
You can use the Sysrq trigger in order to make an immediate reset (it's like pressing ALT-BREAK-b):
echo b >/proc/sysrq-trigger
BEFORE that, you might want to sync all filesystems, to not lose any data:
echo s >/proc/sysrq-trigger
This might only work if CONFIG_MAGIC_SYSRQ is enabled in your kernel. The possible keys are explained at Wikipedia btw.
Solution 3
In a comment you mention (ttyS0) - this isn't the local console, it's a serial console.
I don't think you can do Ctrl-Alt-Del from the serial console.
http://osdir.com/ml/linux.hardware.dell.poweredge/2003-01/msg00200.html suggests a way getting magic-sysrq working over serial - maybe this would be sufficient for rebooting a server?
Related videos on Youtube
ceyko
Updated on September 17, 2022Comments
-
ceyko almost 2 years
I know that Linux may, depending on configuration, allow the interactive user to reboot the server by pressing Ctrl-Alt-Del even without logging in. I have a remote console session over SSH to a remote server that I cannot log into, but I want to reboot it. Is it possible to somehow send the key combination Control-Alt-Delete over SSH (or
telnet
)? If so, how?Edit: to clarify, I am not just connected to the server's
sshd
overssh
- I am connected via a KVM over IP switch, so it's a serial console. But this connection itself is over SSH and my question is how to send the Ctrl-Alt-Del key combination over it.-
kmarsh almost 15 yearsRead your KVM documentation. It should have a way to invoke keychords, especially given you have to use Ctrl-Alt-Del to log into Windows.
-
-
Sam Cogan almost 15 yearsHe said that he is unable to login to the the server, so I don't think that will work. I also don't think he will be ablt to use ctrl-alt-del either
-
Brian Knoblauch almost 15 yearsAllowing ctrl-alt-del over a non-logged in SSH session sounds like a horrible idea! Just think, you'd be able to reboot any server you could open an SSH connection with!
-
ceyko almost 15 yearsI am connected over a remote KVM device - but I don't know how to make it reboot the server. I don't have any menu or anything, I just see the server's screen (in text mode, of course).
-
Dan Carley almost 15 yearsAhh, I see. Do you know the make/model of KVM? I would have thought it provided a break-out menu for such escape sequences.
-
ceyko almost 15 yearsNo, I don't know the model - it's provided by the DC. I suspect there's one KVM for multiple machines, too, so I don't have full access to it, only to my server.
-
Dan Carley almost 15 yearsI would hazard then that it is probably not possible.
-
Travis Campbell almost 15 yearsSSH's built-in "send break" may work too. It's "~B" (tilde-b).
-
ceyko almost 15 yearsYep, sorry - serial console. Updated.
-
ceyko almost 15 yearsGood to know about this, but didn't work in this particular case. :( I guess it's not enabled.
-
ceyko over 13 yearsI doubt that a Windows utility would have worked on a Linux server. :)