I have got the following line in my /etc/sudoers after editing it via visudo and I am unable to sudo without a password. Does anyone have any ideas on why this is not working properly?


  • This works for me, although you could shorten it to myusername ALL = NOPASSWD: ALL. Did you log out and back in after you made the change?
    – n.st
    Sep 14 '13 at 11:02
  • This still doesn't work even after I have re-logged in.
    – Peter
    Sep 14 '13 at 13:00

Ok, I fixed it. The line needs to be added to the END of the file and not just anywhere for it to work.


I tried the above method with no success. Luckily, after hours of dedication I will spare anyone else from having this trouble again :)

%username% is the global variable for your username(replace it)

Open up a terminal windows and type

sudo usermod -a -G root %username%

Then type

sudo nano /etc/pam.d/su

Goto line 19 and remove the # before

# auth sufficient pam_wheel.so trust

Save your file. Problem solved :)

The first command adds your username to the group:root.

The second command allows all members of root to be su.

  • This does not answer the question, and represents what is usually a very bad idea. Jul 20 '15 at 22:45

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.