PDA

View Full Version : [ubuntu] sudo does not respect NOPASSWD



Schizoid
May 3rd, 2008, 12:48 AM
when adding to /etc/sudouser

username ALL=(ALL) NOPASSWD: ALL

username being my actual user name . I'm still prompted per session for my password

I know what this line does, and I'm know what I'm doing and have used this 1000 of times on my linux systems.

I'm wondering why this does not work in ubuntu?

aysiu
May 3rd, 2008, 12:52 AM
Did you add the line to the end of your /etc/sudoers file or to the middle/beginning?

Schizoid
May 3rd, 2008, 12:56 AM
at the beginning. but moving it to bottom does not have an effect.

kerry_s
May 3rd, 2008, 12:56 AM
when adding to /etc/sudouser

username ALL=(ALL) NOPASSWD: ALL

username being my actual user name . I'm still prompted per session for my password

I know what this line does, and I'm know what I'm doing and have used this 1000 of times on my linux systems.

I'm wondering why this does not work in ubuntu?

that's very unsafe, you should make it application specific.

mine->

aysiu
May 3rd, 2008, 01:04 AM
at the beginning. but moving it to bottom does not have an effect.
That's weird. This thread (http://ubuntuforums.org/showthread.php?t=135160) would seem to indicate that positioning matters.

I've never heard of the /etc/sudouser file. Have you tried editing /etc/sudoers instead?

kerry_s
May 3rd, 2008, 01:13 AM
also make sure your editing with->
sudo visudo

or you will corrupt it and sudo won't work anymore.

if you have to have something more gui-> sudo xedit /etc/sudoers <-will work, but won't tell you if you made a mistake. to save in xedit click save 2x.

|{urse
May 3rd, 2008, 01:14 AM
holy deja vu

Schizoid
May 3rd, 2008, 01:15 AM
my mistake I meant /etc/sudoers

regardless I've never had an issue with position. and moving position still does not resolve the issue.

Schizoid
May 3rd, 2008, 01:17 AM
also make sure your editing with->
sudo visudo

or you will corrupt it and sudo won't work anymore.

if you have to have something more gui-> sudo xedit /etc/sudoers <-will work, but won't tell you if you made a mistake. to save in xedit click save 2x.

of course I'm using visudo

Dr Small
May 3rd, 2008, 03:17 AM
Hmm, well, what does this do?

user host = NOPASSWD: ALL

lemming465
May 3rd, 2008, 03:30 AM
Hmm. Not sure why it isn't working for you; I just tried it on my hardy box and it worked fine. I also notice:
# Uncomment to allow members of group sudo to not need a password
# %sudo ALL=NOPASSWD: ALL


At which point I'd be strongly tempted to try
sudo usermod -G sudo -a $USER
sudo perl -pi -e 's/^# // if /%sudo/;' /etc/sudoers

Schizoid
May 3rd, 2008, 03:47 AM
ok I finally figured this out. turns out I didn't add myself to the last line like someone suggested. I thought i did but I must have not tested right. "kinda busy with other work also"

so it turns out the real issue is %admin ALL=(ALL) ALL overides all NOPASSWD statements since the default install user is added
to admin. if you added a new regular user this wouldn't be the case.

and if you actually uncommented #%sudo ALL=NOPASSWD: ALL and add your username to the sudo group . Odds are it wont work since %admin would override it . so you would have to move it to the last line also. see https://answers.launchpad.net/ubuntu/+question/31811

anyways, thanks for the help everyone