Subject: Re: Lab machines - some questions
To: Hubert Feyrer <hubert.feyrer@rrzc1.rz.uni-regensburg.de>
From: John F. Woods <jfw@jfwhome.funhouse.com>
List: port-i386
Date: 12/03/1997 08:30:45
>maybe I'll get the chance to setup some of our lab machines for dual-boot wirh
>WinNT... how my questions is, how do I enable users to shotdown the machine,
>without knowing the root password? Shutting down via Ctl-Alt-Del would be
>best... does PC- or VT-console provite any hooks there?

If you want *anyone* to be able to shut down your computer,
`chown root /sbin/shutdown ; chmod u+s /sbin/shutdown' is as good a way
as any.

The pccons driver traps Ctl-Alt-Esc as a break into DDB (if it's enabled);
pcvt will, if you foolishly define PCVT_CTRL_ALT_DEL, reset the CPU on
Ctl-Alt-Del.  (You do not want to shut down a multiuser system by resetting
the CPU; not even NT does that!)

The pccons and pcvt drivers seem to disagree about what the keyboard scan
codes are, AND they both use small integer constants where documented manifest
constants would have been appropriate (GRR!), but rigging them both to do
something useful on Ctl-Alt-Del shouldn't be hard.  *What* it should do is
another question, but most likely would be to send a signal to process 1
telling it to do the shutdown thing.  As it happens, the "halt" command
currently does all the work of halting the system (it suspends init with
a SIGTSTP), so you'd probably have to somehow duplicate that functionality
in init.  Possibly the best way would be to field SIGUSR1, and have init
fork off an /sbin/reboot process in response.  (Can interrupt handlers
send signals to processes?)  Perhaps more clever would be to rig up some
more secure communication channel between the console keyboard handler and
init, perhaps a UNIX-domain socket that is created before /sbin/init is
exec'd and which never appears in the filesystem.

One unfortunate difference between this and the Windows NT Ctl-Alt-Del handling
is that the shutdown would be mandatory; NT (to the surprise of those who
haven't used it) instead brings up a dialog box with several options (kill
process, log out, cancel, and (of course) shut down [as I recall]).  With
"shutdown" you at least get an opportunity to hit Ctl-C to stop it (unless
you typed "shutdown now", in which case your opportunity is very, very short).