shutdown can only be executed by UID 0 and GID 0 (which is root's userid). If you really, really what to be able to shut the system down without using
su to do it, you can change the owner and group of your shell program to root and change the mode to 4755 (you must do this as root). You could also use the
init utility instead of the
shutdown utility in your shell program; i.e.,
Code:
#!/bin/sh
#
# non-root user system shutdown
#
/sbin/init 0
Bear in mind that either is not a real good idea when you can simply
Code:
su -
Password: root-password
init 0
Although you can do something (like set the so-called "su" bit, which is what mode 4755 does) it can come back and bite you; there is a reason that certain commands require root permission to be used and you should think it through before you jump off this cliff.
[EDIT]
Well, ignorant me (here's one of those things that won't port from Solaris). Thanks to gazl for pointing out that SUID doesn't work in Linux (and, dang it, that's a
good thing, too).
Sigh.