|
|
||
Adding a Shutdown Command to inittab© Copyright Darrell Anderson. The K Desktop Environment (KDE) login manager (KDM — K Display Manager) provides the means to shutdown a computer. The command line provides no such direct mechanism unless a user is logged in as root or has been provided shutdown abilities through sudo. With most standard GNU/Linux distros, from the command line a user can reboot a computer but cannot shutdown or power down the computer. There is a way to remedy this shortcoming. The solution is to add a keyboard sequence that will perform the shutdown or halt command. In most if not all GNU/Linux distros, the standard keyboard sequence to reboot a box is Ctrl-Alt-Del. Of course, in critical situations where rebooting is not desired, such as with a dedicated server, this keyboard sequence is disabled. Bear in mind then that the following solution is not recommended for such environments. In this mini How-To we will add the Ctrl-Alt-End keyboard sequence as the means to shutdown a computer from the command line. Let us first modify the /etc/inittab configuration file to recognize a keyboard shutdown request. Within that file most users should find a line looking something like this: # "Three Finger Salute" for rebootca::ctrlaltdel:/sbin/shutdown -t1 -r now Just below that line modify the file by adding the following: # "Three Finger Salute" for poweroff (ctrl-alt-end)ce::kbrequest:/sbin/shutdown -t1 -h now As far as I know the two-letter symbol used at the beginning of the line can be anything as long as the symbol is unique within the inittab file. The next portion of the line must be typed exactly as shown. The time delay represented by -t1 (1 second delay) may be modified to suit personal tastes. The next step is to modify your keyboard layout map.
You must reboot your computer or reinitialize the init command to read the new inittab file. To perform the latter without rebooting, at the command line type init q. You now can run the rc.keymap script manually and the keyboard shutdown request should work the same as the keyboard reboot request. Whether or not logged in at the console, press Ctrl-Alt-End and the computer will shutdown. If you have power management abilities then the box will power off as well. If you use the files included in this How-To, bear in mind the files include modifications to map the Right Alt key to function the same as the Left Alt key when in console mode. If you do not want those modifications then edit your keymap files on your own box accordingly. /usr/share/kbd/keymaps/i386/qwerty/us-two-alt.map.gz Finis. |
||