How to: Allow any users to Shutdown Linux server
You need to use sudo command to grant a permission to other users to shutdown your server. sudo allows a permitted user to execute a command as the superuser or another user, as specified in the /etc/sudoers file. Login as a root user and type visudo command to edit the sudoers file:
Allow any user to shutdown my Linux server
For example, allow user rocky to shutdown computer (first login as a root user):
$ su -
# visudo
Append following text to file:
rocky server.mydomain.com=/sbin/halt /sbin/reboot
Save file and exit to shell prompt. Now rocky can halt server by typing command:
$ sudo /sbin/halt
Output:
Password:
Please note that at password prompt rocky need to type his password.
Another way is to allow other users to shutdown server is to add them to /etc/shutdown.allow access control file. shutdown command can check to see if an
authorized user is logged in on one of the virtual consoles. If shutdown command is called with the -a argument , it checks to see if the file /etc/shutdown.allow is present. It then compares the login names in that file with the list of people that are logged in on a virtual console only if one of those authorized users or root is logged in, it will proceed. Otherwise, it will write the message
shutdown: no authorized users logged in
First login as a root user:
# touch /etc/shutdown.allow
# echo"username" >> /etc/shutdown.allow
On the other hand, use text editor such as vi to add username (Max 32 names are allowed):
# vi /etc/shutdown.allow
Shutdown computer using following command:
$ /sbin/shutdown -a -h 0
See also:
You may also be interested in other helpful articles:
- Shutdown account to shutdown Linux server
- Linux Shutdown Command and Logfile
- Linux Disable the Ctrl-Alt-Delete shutdown keys
- Schedule Windows server to reboot or shutdown automatically
- I turn my Linux computer off and when I turn it on it runs disk check (fsck) on hard disk. Why?
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: linux_server, shutdown_command, shutdown_computer, sudoers, sudo_command, visudo_command



Recent Comments
Yesterday ~ 24 Comments
Yesterday ~ 24 Comments
Yesterday ~ 3 Comments
Yesterday ~ 2 Comments
09/05/2008 06:08 pm (2 days ago) ~ 16 Comments