Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 over SSH - 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.

share|improve this question
2  
Read your KVM documentation. It should have a way to invoke keychords, especially given you have to use Ctrl-Alt-Del to log into Windows. –  kmarsh Aug 5 '09 at 12:08

8 Answers 8

up vote 3 down vote accepted

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

share|improve this answer
    
SSH's built-in "send break" may work too. It's "~B" (tilde-b). –  Travis Campbell Aug 5 '09 at 14:53
    
Good to know about this, but didn't work in this particular case. :( I guess it's not enabled. –  EMP Aug 5 '09 at 15:50

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.

share|improve this answer

The three-fingered reboot is only available from a local console.

It is handled by the following inittab line:

# What to do at the "Three Finger Salute".
ca:12345:ctrlaltdel:/sbin/shutdown -r now

You would need to use the shutdown, halt or reboot commands from a shell with root privileges instead, if you don't have physical access to the machine.

share|improve this answer
    
Thanks, but I am at the local console (ttyS0) - just remotely over a KVM-IP device, which uses SSH. –  EMP Aug 5 '09 at 11:19
    
Ahh, I see. Do you know the make/model of KVM? I would have thought it provided a break-out menu for such escape sequences. –  Dan Carley Aug 5 '09 at 11:39
    
No, 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. –  EMP Aug 5 '09 at 12:49
    
I would hazard then that it is probably not possible. –  Dan Carley Aug 5 '09 at 13:05

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?

share|improve this answer
    
Yep, sorry - serial console. Updated. –  EMP Aug 5 '09 at 15:43

Look into a remote KVM switch to reboot without SSH access. http://en.wikipedia.org/wiki/KVM_switch#Remote_KVM_devices

share|improve this answer
    
I 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). –  EMP Aug 5 '09 at 11:25
    
What is the brand/model of KVM? –  MathewC Aug 5 '09 at 12:09

Is it possible the command has been disabled? I regularly disable it on my production servers, usually to protect them from me when I forget that I'm logging into a Linux machine instead of a Windows machine and accidentally press Ctrl-Alt-Del and subsequently reboot the machine.

On machines which I do leave it so that a non-technical person can reboot, I extend the time in Dan's example from "now" to "2 minutes" so there's a sliver of a chance the reboot can be aborted if needed.

share|improve this answer

if you know the username/password of the remote machine, you can use SysInternals PSShutdown command to reboot a remote computer. Note, if you have gone to the trouble of forcing SSH to a KVM, your server is probably setup so that you can't reboot machines without logging in. In fact, its the default for servers from MS, if I remember correctly.

share|improve this answer
    
I doubt that a Windows utility would have worked on a Linux server. :) –  EMP Mar 21 '11 at 8:54

Isn't it easier to just issue "shutdown -h now", "reboot" or "halt" on the command line depending on what you prefer to happen to the machine?

share|improve this answer
1  
He 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 –  Sam Aug 5 '09 at 11:07
1  
Allowing 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! –  Brian Knoblauch Aug 5 '09 at 11:12

Your Answer

 
discard

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.