You are not logged in.

#1 2010-07-12 20:09:01

kportertx
Member
Registered: 2010-06-22
Posts: 12

[SOLVED] sudo pm-suspend requires password [SOLVED]

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

#2 2010-07-12 20:15:43

moose jaw
Member
From: Milwaukee
Registered: 2007-08-20
Posts: 104

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

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

#3 2010-07-12 20:31:22

kportertx
Member
Registered: 2010-06-22
Posts: 12

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

Tried the spaces, still behaves the same.

Offline

#4 2010-07-12 21:31:34

xamaco
Member
From: Corsica, France
Registered: 2010-04-05
Posts: 87

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

do:
%power ALL=(ALL) NOPASSWD:/sbin/shutdown -h now
%power ALL=(ALL) NOPASSWD:/sbin/reboot
work ???

Offline

#5 2010-07-12 21:46:44

Meyithi
Member
From: Wirral, UK
Registered: 2009-06-21
Posts: 550
Website

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

# 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.


The mind roams more freely in empty rooms.
dwm - colours - ncmpcpp - system
irc://irc.freenode.net:meyithi

Offline

#6 2010-07-12 22:01:51

kportertx
Member
Registered: 2010-06-22
Posts: 12

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

I am using visudo, it is not picking up errors from using spaces.  I tried the spaces and it still does not work. neutral

Offline

#7 2010-07-14 05:58:47

kportertx
Member
Registered: 2010-06-22
Posts: 12

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

*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

#8 2010-07-14 06:05:36

loafer
Member
From: the pub
Registered: 2009-04-14
Posts: 1,772

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

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

#9 2010-07-14 06:07:03

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

I have

%wheel  ALL=(ALL) NOPASSWD: ALL

and I don't get prompted for a password. My user belongs to wheel.

Offline

#10 2010-07-14 06:09:39

kportertx
Member
Registered: 2010-06-22
Posts: 12

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

loafer wrote:

Try with the NOPASSWD entries at the very end of the sudoers file.

hmm 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

#11 2010-07-14 06:15:26

kportertx
Member
Registered: 2010-06-22
Posts: 12

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

karol wrote:

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

#12 2010-07-14 06:16:27

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

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

#13 2010-07-14 06:22:24

kportertx
Member
Registered: 2010-06-22
Posts: 12

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

xamaco wrote:

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 sad ... Which is what brought me here. wink ...  Can anyone tell me why this shouldn't work.  Also I have tried with a space after NOPASSWD:..

Thanks!

Offline

#14 2010-07-14 06:31:17

hume's doona
Member
Registered: 2009-12-11
Posts: 206

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

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

#15 2010-07-14 06:33:37

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

> 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

#16 2010-07-15 05:58:54

kportertx
Member
Registered: 2010-06-22
Posts: 12

Re: [SOLVED] sudo pm-suspend requires password [SOLVED]

loafer wrote:

Try with the NOPASSWD entries at the very end of the sudoers file.

lol 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

Board footer

Powered by FluxBB