Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to setup sudo with no password but still I get prompted for password.

I'm using Ubuntu, here is the relevant line from the sudoers configuration file :

gandalf ALL=(ALL:ALL) NOPASSWD: ALL
share|improve this question
add comment

4 Answers

Try dropping the extra :ALL, example:

gandalf ALL=(ALL) NOPASSWD: ALL

share|improve this answer
    
But still I have to type in password .. when I open/close terminal –  Gandalf Jul 26 '12 at 15:21
1  
What do you mean exactly by "when I open/close terminal"? –  mattdm Jul 26 '12 at 15:56
    
Well there is icon terminal I click on it the terminal pops out I issue the sudo command and I get prompted for password. After I type the password I no longer get prompted. Then I click on the x standard for quiting from any program and re-open terminal and again prompted for password –  Gandalf Jul 26 '12 at 16:17
1  
Your desktop is running under the user gandalf correct? Is the system user spelled the same way (hint: Linux user names are case sensitive. –  Tim Jul 26 '12 at 16:49
add comment

My "man sudoers" on ubuntu contains this example line

FULLTIMERS ALL = NOPASSWD: ALL

FULLTIMERS is an alias rather than a user, but it should still work if you put a user name there. As far as I know, NOPASSWD: has to come before the first mention of ALL (after the equals sign) to bind to it.

share|improve this answer
    
But still I have to type in password .. when I open/close terminal –  Gandalf Jul 26 '12 at 15:41
1  
How exactly are you opening the terminal - is it a link in the menu, or something else? If you open a shell and type "sudo ls" in there, does it still ask for a password? (What I suspect is that your command to open/close terminal is actually doing something other than just calling sudo.) –  Bristol Jul 26 '12 at 15:53
    
Well there is icon terminal I click on it the terminal pops out I issue the sudo command and I get prompted for password. After I type the password I no longer get prompted. Then I click on the x standard for quiting from any program and re-open terminal and again prompted for password –  Gandalf Jul 26 '12 at 16:21
add comment

I use a group call sudo and have the line

%sudo ALL=NOPASSWD: ALL

which seems to work.

share|improve this answer
add comment

Do you have other rules in your sudoers file, by any chance? The rules are applied in order, so if you have a rule allowing you to run a command with a password prompt followed by another rule that allows you to run the command without a password prompt, you'll have to type the password. Put the no-password rule first.

See Why is sudo telling me my password is wrong?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.