You are not logged in.
Can anyone tell me why sudo pm-suspend still requires a password even though I have set the following in my sudoers file
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
# Failure to use 'visudo' may result in syntax or file permission errors
# that prevent sudo from running.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# Host alias specification
# User alias specification
# Cmnd alias specification
# Defaults specification
# Defaults specification
# Reset environment by default
Defaults env_reset
# Set default EDITOR to vim, and do not allow visudo to use EDITOR/VISUAL.
Defaults editor=/usr/bin/nano, !env_editor
Defaults:ALL timestamp_timeout=0
# Runas alias specification
# User privilege specification
root ALL=(ALL) ALL
%power ALL=(ALL) NOPASSWD:/sbin/shutdown -h now
%power ALL=(ALL) NOPASSWD:/sbin/reboot
%power ALL=(ALL) NOPASSWD:/usr/sbin/pm-suspend
%power ALL=(ALL) NOPASSWD:/usr/sbin/pm-hibernate
%power ALL=(ALL) NOPASSWD:/usr/sbin/pm-powersave
# Uncomment to allow people in group wheel to run all commands
%wheel ALL=(ALL) ALL
# Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
# Samples
# %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users localhost=/sbin/shutdown -h now
And here are a list of the groups for my user
adm disk wheel locate games network video audio optical floppy storage power users kporter
Thanks ahead of time!
Last edited by kportertx (2010-07-15 06:00:15)
Offline
Here's a dumb suggestion, but have you tried adding a space btw 'NOPASSWD:' and the paths to the relevant commands? That's how I've got my sudoers file set up and NOPASSWD works as expected.
Offline
Tried the spaces, still behaves the same.
Offline
do:
%power ALL=(ALL) NOPASSWD:/sbin/shutdown -h now
%power ALL=(ALL) NOPASSWD:/sbin/reboot
work ???
Offline
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
# Failure to use 'visudo' may result in syntax or file permission errors
# that prevent sudo from running.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# Host alias specification
# User alias specification
# Cmnd alias specification
Cmnd_Alias NETBOOK_CMDS = /usr/local/sbin/backlight, /usr/local/sbin/backlight_reset, /usr/local/sbin/wireless_toggle, /usr/local/sbin/cpufreq_toggle, /usr/sbin/pm-suspend
# Defaults specification
# Runas alias specification
# User privilege specification
root ALL=(ALL) ALL
meyithi ALL=(ALL) ALL
# Uncomment to allow people in group wheel to run all commands
# %wheel ALL=(ALL) ALL
# Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
# Samples
# %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users localhost=/sbin/shutdown -h now
%users ALL=(ALL) NOPASSWD: NETBOOK_CMDS
You definitely need the space, if you're not using visudo to edit sudoers it won't pick up the errors.
Offline
I am using visudo, it is not picking up errors from using spaces. I tried the spaces and it still does not work.
Offline
*bump*
Still not working and I have tried the spaces and I'm using visudo.
Last edited by kportertx (2010-07-14 05:59:21)
Offline
Try with the NOPASSWD entries at the very end of the sudoers file.
All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.
Offline
I have
%wheel ALL=(ALL) NOPASSWD: ALL
and I don't get prompted for a password. My user belongs to wheel.
Offline
Try with the NOPASSWD entries at the very end of the sudoers file.
Yea thats how I had it before, then I decided to move it above the wheel line. Hm wonder if at the end AND no spaces will work. I'll try this as soon as I can. Thanks for the suggestion!
Offline
I have
%wheel ALL=(ALL) NOPASSWD: ALL
and I don't get prompted for a password. My user belongs to wheel.
Yea... that would and when I tested, did work. But isn't that damn near the same as running everything as root. Sure malicious programs on Linux are extremely rare, but seems this would sure make it easy to be affected by some. May as well run as root.
Offline
Alternatively try
meyithi ALL=(ALL) ALL
meyithi ALL=NOPASSWD: /usr/sbin/pm-suspend
or
meyithi ALL = (ALL) NOPASSWD: /usr/sbin/pm-suspend
Last edited by karol (2010-07-14 06:22:39)
Offline
do:
%power ALL=(ALL) NOPASSWD:/sbin/shutdown -h now
%power ALL=(ALL) NOPASSWD:/sbin/reboot
work ???
Not sure what you mean xamaco.
If you mean do the individual commands, shutdown and reboot, then yes! If you reffering to are they working in the configuration then no ... Which is what brought me here. ... Can anyone tell me why this shouldn't work. Also I have tried with a space after NOPASSWD:..
Thanks!
Offline
Just a possibly dumb query, your topic title is "sudo pm-suspend" have you tried just "$pm-suspend" ? I haven't set up power with no password, butI have with networking, and if I type sudo it will prompt for password, if I don't it just works.
Sorry if that's wrong, just my 2c
Offline
> if I type sudo it will prompt for password, if I don't it just works
That's weird.
Maybe you have an alias for 'pm-suspend' somewhere?
[karol@black ~]$ type iftop
iftop is aliased to `sudo iftop'
Offline
Try with the NOPASSWD entries at the very end of the sudoers file.
Really! that was the solution. Someone please tell me why this worked. It just doesn't make sense to me why NOPASSWD lines must be at the end.
Offline