Shutdown from login prompt in tty
On most Linux systems, the Ctrl+Alt+Del key sequence action is configured in either /etc/inittab
or /etc/init/control-alt-delete.conf
.
Usually, this will reboot the system, but you could modify the command to halt the system instead.
In /etc/inittab
:
ca::ctrlaltdel:/sbin/shutdown -t3 -h now
Or /etc/init/control-alt-delete.conf
:
start on control-alt-delete
exec /sbin/shutdown -h now "Control-Alt-Delete pressed"
I've done this before with a user named "s
" and no password.
IIRC you set the user's shell to /sbin/shutdown
. Prolly need to add it to /etc/shells
.
Here's a nice little trick that kind of surprised me (life saver if you freeze a remote system with no iLO (or KVM).
The Magic SysRq key. If it is active on your system, I believe hitting ALT + SysRq + o
should turn off your system. This is a hard shutdown (if I recall correctly, don't want to test it right now!) so you can press:
ALT + SysRq + e
(nicely kill all processes)
ALT + SysRq + i
Kill everything else)
ALT + SysRq + s
sync all file systems,
ALT + SysRq + u
to remount partitions as read only,
then do the b or o combination (reboot or shutdown)
Anyway, I don't think this is the best way to halt your system, the other answers may be more suitable, but the above should help you out if your stuck!