Saturday, April 24, 2010

How to shutdown and reboot without sudo password

First of all you need sudo package.
apt-get install sudo
Modify /etc/sudoers with visudo.
# Cmnd alias specification
Cmnd_Alias SHUTDOWN_CMDS = /sbin/shutdown, /sbin/reboot

# User privilege specification
user1  ALL= NOPASSWD: SHUTDOWN_CMDS
Now user1 is able to restart:
user1@deby:~$ sudo /sbin/reboot

Broadcast message from root@deby (pts/0) (Sat Apr 24 00:06:53 2010):

The system is going down for reboot NOW!
or shutdown the system without sudo password:
user1@deby:~$ sudo /sbin/shutdown -h now

No comments :

Post a Comment