About sudo's NOPASSWD?

I have ever posted this question before. That post had been flagged "SOLVED" which I think so before. However, it still has not been solved.

Code:
>cat [FILE]/usr/local/etc/sudoers[/FILE] | grep shutdown
Cmnd_Alias HALT=[FILE]/sbin/shutdown[/FILE] -p now
Cmnd_Alias REBOOT=[FILE]/sbin/shutdown[/FILE] -r now

>cat [FILE]/usr/local/etc/sudoers[/FILE] | grep NOPASSWD
%wheel ALL=NOPASSWD: HALT,REBOOT

The result is reboot does not need root's password which is ok. But halt still needs the root's password.

Sincerely!
 
This might not be what you're looking for but adding your user to the operator group will allow you to execute /sbin/shutdown (along with a few other things) without using su (or sudo) to elevate your permissions.
 
iddqd said:
This might not be what you're looking for but adding your user to the operator group will allow you to execute /sbin/shutdown (along with a few other things) without using su (or sudo) to elevate your permissions.
Code:
>id sw2wolf
uid=1001(sw2wolf) gid=1001(sw2wolf) groups=1001(sw2wolf),0(wheel),5([color="Red"]operator[/color]),920(vboxusers)

I have been in operator now.
 
phoenix said:
Sigh.
What is the full sudo command that you are typing? And what is the output of that command?
The command is:

sudo /sbin/shutdown -p now
sudo /sbin/shutdown -r now

No special output, it just needs me to enter the root's password which I do not want.
 
Hi

Sure you are editing sudoers file with visudo?

This kind of line should work (at least worked for me):

Code:
%wheel ALL=(ALL) NOPASSWD: /sbin/shutdown -p now, /sbin/shutdown -r now

And command to shutdown:

sudo /sbin/shutdown -p now

Similar for halt should work
 
Back
Top