Look into sudo, it lets a user run a command as root.:
man sudo.
What you should do is put an entry in the /etc/sudoers file like this:
InsaneBob ALL = (ALL) NOPASSWD: ALL
or not necessarily all, if that's not what you want [you can set up a command alias], although the nopasswd option is useful. Then, the user can:
sudo /sbin/shutdown -h now
or whatever. You could set up a script to do this if you don't want to type it every time.
Of course, the other option would be to chmod 777 the /sbin/shutdown script, and then you could just run
/sbin/shutdown -h now, without all the sudo hassle. However, this does pose security risks, and is not the correct solution if you only want to enable this access to one user.
Last edited by andrewlkho; 08-23-2003 at 03:37 PM.
|