[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: turning off computer



( Re Message From: I Brake for Moths )
> 
> Is there a way for a user without root priveleges to cleanly unmount the 
> root file system and shutdown the computer?
> 
> I've been running 'init 0' as root before turning off the box, but I 
> don't want to have to give out the root password to my family (it's bad 
> enough that I know it!) just so they can turn the thing off when I'm not 
> around.  We'd rather not leave it on when it is not in use.
> 
> Thanks,
> Rikki

No way to do it directly -- of course. However, root can fix it so it can
be done.

Root starts a little program (owned by root) which just loops and watches
say /tmp for the occurence of a file (owned by anyone) called say
/tmp/down_now.

The program then deletes /tmp/down_now, and then shuts the system down in
the usual way (e.g. by calling shutdown -h now).

Then all any user needs to do is "touch /tmp/down_now". An example program
might be

   while true ; do
     if [ -f /tmp/down_now ] ; then
        rm /tmp/down_now
	shutdown -h now
     fi
     sleep 60
   done

Of course, if you can trust people to manage to switch off a re-booting
computer during the "safe period" (i.e. after re-boot has started but
before Linux really gets under way) then simply Ctrl-Alt-Del should do it.

Ted.                                    (Ted.Harding@nessie.mcc.ac.uk)


Reply to: