`sudo` asks for password even when I have no password set?

11,284

If you must remove the need for a password to use sudo, you can edit the /etc/sudoers file using sudo visudo command.

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) NOPASSWD:ALL

and add NOPASSWD:ALL for sudoers group as shown above

Share:
11,284

Related videos on Youtube

udiboy1209
Author by

udiboy1209

Updated on September 18, 2022

Comments

  • udiboy1209
    udiboy1209 over 1 year

    I removed the password from my account using the "User Accounts" window and then on running sudo, it prompted me for a password, even when i didn't have one. I tried pressing enter without entering anything but it didn't help.

    Also I couldn't unlock my account to set a new password in the "User Accounts" window in "System Settings" because it kept prompting for a password and wouldn't except an empty string, just like sudo. I then finally set a new password using passwd.

    Is this a bug which shouldn't be happening? How do I prevent this from happening?

    • Admin
      Admin about 10 years
      Did you try to logout and then login again?
    • Admin
      Admin about 10 years
      @NikosGr resetting the password using passwd solved the problem.
  • udiboy1209
    udiboy1209 about 10 years
    does this also stop the keyring prompts at the start?
  • Stormvirux
    Stormvirux about 10 years
    for key ring see the different answers to this question depending on your version of ubuntu askubuntu.com/questions/867/…