Shutdown Linux server with shutdown user
How to enable the shutdown user on RedHat Enterprise Linux (and alike systems) so it can be used to shutdown the system without having to use the root user?
Set a password for the user:
passwd shutdown
Edit the file ''/etc/sudoers'':
visudo
Add this line to it (or enable/change an existing line):
shutdown localhost=NOPASSWD: /sbin/shutdown –h now
It will limit the action to logins on the console itself. So remotely the command will not work. If you want to, change it to
shutdown ALL=NOPASSWD: /sbin/shutdown –h now
to be used without password or
shutdown ALL=/sbin/shutdown –h now
to be used with entering the sudo password. Change the login shell for user shutdown:
vi /etc/passwd
Find the shutdown entry and change the part after the last colon to:
/usr/bin/sudo /sbin/shutdown –h now
Now you can login with the user shutdown and see how the system goes down.
- 2324 reads
