How to give a normal user shutdown and reboot access on a Linux station

Sometimes you may need to allow a normal user to shutdown or reboot the system. You can do that easily, by adding a line in /etc/sudoers.

The allowed user will get root priviledges only for the shutdown and reboot commands. Do not edit the /etc/sudoers by hand, use visudo instead. visudo opens the /etc/sudoers file in the default text editor. The shell will warn you if you write something wrong there.

How to allow a normal user to shutdown or reboot the Linux station, without using his password:

Add the following line to /etc/sudoers: user ALL=(root) NOPASSWD:/usr/sbin/shutdown,/usr/sbin/reboot

# grep geekster /etc/sudoers
geekster ALL=(root) NOPASSWD:/usr/sbin/shutdown,/usr/sbin/reboot

To give the geekster user password protected access for shutdown and reboot, add this in the /etc/sudoers file:

# grep geekster /etc/sudoers
geekster ALL=(root) /usr/sbin/shutdown,/usr/sbin/reboot

Tagged with: , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

Your email address will not be published. Required fields are marked *




Subscribe to get the latest Linux news and how to guides directly on your e-mail!