Have you ever wondered why shutdown account exists on Linux server, especially under Red Hat Enterprise Linux distribution? The answer is quite simple – shutdown account can shutdown server. Here is how you can enable the shutdown account:
1) Login as a root user .
2) Setup password for the shutdown account:
# passwd shutdown
2) Add access to shutdown â€“h now via sudo:
Put any one of following line in your sudo configuration file:
shutdown ALL=/sbin/shutdown â€“h now
shutdown localhost=/sbin/shutdown â€“h now
Note that localhost will only allow sudo from local terminal. For network based shutdown make sure you use ALL or an IP address or a domain name, for complete syntax refer sudo(8), and sudoers(5) command man page.
4) Save and close the file.
5) Change the shutdown shell:
# vi /etc/passwd
Replace existing shell entry (/sbin/shutdown) to
/usr/bin/sudo /sbin/shutdown â€“h now
Chang text from:
shutdown:x:6:0:shutdown:/sbin:/usr/bin/sudo /sbin/shutdown â€“h now
6) Close and save the file.
7) Test it by login into system with shutdown username and password.
8) Please, note down that sudo will prompt for password. If you wish to get rid of this issue use NOPASS option in sudo configuration file.
9) Alternatively, you can use the sudo command only to achieve the same effect. This simple hack ensures that ordinary user can shutdown system without touching other part of the system.Share this on: