0

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
  • Drop the ":ALL" inside the parentheses and your syntax is correct. Therefore, the problem must be elsewhere: wrong username (execute id to see what the system thinks it is), other configuration line for gandalf that overrides this one, invisible character in the file (for example, it was copy/pasted from a Windows word processor), and so on. Given that you logged in here as Gandalf, could it be that your Linux username also uses a capital-G? – Azhrei May 19 '15 at 22:50
2

Try dropping the extra :ALL, example:

gandalf ALL=(ALL) NOPASSWD: ALL

  • 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
1

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?

0

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.

  • 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
0

I use a group call sudo and have the line

%sudo ALL=NOPASSWD: ALL

which seems to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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