![]()
|
SysAdmin Topics
|
shutdown account by Joseph Kwan PurposeThis note documents how to configure a shutdown account for a system to provide an easy way for a system to be shutdown just by entering the password for the account on a login. I do this for several systems I have that are integrated in hardware racks and the systems are treated more as instruments rather than as a computer. sudo is use in combination with the login script. The NOPASSWD sudo configuration is used to allow the shutdown command to run as root, without prompting for the user password. ConfigurationConfiguration just involves setting up the user account (non-privileged), configuring sudo to allow the account to run shutdown and then setting up the account start up file so the sudo shutdown command is run upon login. For the user account, I'm using the account name shutdown as the login account. /etc/passwd shutdown:x:17991:60001:shutdown account:/var/sys/shutdown:/usr/bin/bash /etc/shadow shutdown:_encrypted password_:13942:::::: sudoers # define a command alias with the path for shutdown Cmnd_Alias SHUTDOWN=/usr/sbin/shutdown # shutdown account capabilities definition # the "NOPASSWD" option allows the command to run # without requiring the user's password shutdown _hostname_=NOPASSWD:SHUTDOWN The first field is the account name, shutdown in this configuration. Then the host name(s) and the sudo capabilities authorized. If you have multiple hosts you can define a host alias and use that alias. .bash_login/.bashrc # .bashrc/.bash_login (symlink to each other) sudo /usr/sbin/shutdown -y -g0 -i5 Note: this assumes sudo is in the path. The -i5 shutdown option powers down a Solaris machine.
|