The reboot and poweroff commands in the /usr/bin directory are symbolic links to /usr/bin/consolehelper. These are the default commands for normal users.
Quote:
|
Originally Posted by consolehelper manpage
consolehelper is a tool that makes it easy for console users to run
system programs, doing authentication via PAM (which can be set up to
trust all console users or to ask for a password at the system adminis-
trator’s discretion). When possible, the authentication is done graph-
ically; otherwise, it is done within the text console from which con-
solehelper was started.
It is intended to be completely transparent. This means that the user
will never run the consolehelper program directly. Instead, programs
like /sbin/shutdown are paired with a link from /usr/bin/shutdown to
/usr/bin/consolehelper. Then when non-root users (specifically, users
without /sbin in their path, or /sbin after /usr/bin) call the "shut-
down" program, consolehelper will be invoked to authenticate the action
and then invoke /sbin/shutdown. (consolehelper itself has no priv-
iledges; it calls the userhelper(8) program do the real work.)
consolehelper requires that a PAM configuration for every managed pro-
gram exist. So to make /sbin/foo or /usr/sbin/foo managed, you need to
create a link from /usr/bin/foo to /usr/bin/consolehelper and create
the file /etc/pam.d/foo, normally using the pam_console(8) PAM module.
|
The root user, by default, executes those commands from /sbin. The poweroff and reboot commands in /sbin are symbolic links to the 'halt' executable. Which itself is really just a wrapper for the 'shutdown program.
Quote:
|
Originally Posted by halt manpage
Halt notes that the system is being brought down in the file
/var/log/wtmp, and then either tells the kernel to halt, reboot or
poweroff the system.
If halt or reboot is called when the system is not in runlevel 0 or 6,
in other words when it’s running normally, shutdown will be invoked
instead (with the -h or -r flag). For more info see the shutdown(8)
manpage.
|
All this tangled mess is setup to allow normal users (with proper permission) to poweroff or reboot the system without being root.
hth,
Jason