How to stop Ubuntu from asking for your sudo password

If you use Ubuntu Linux it is quite likely that at some point or another you may have been frustrated at its asking for your password when trying to perform an administrative tasks, such as installing programs or changing system settings. Ubuntu uses the sudo tool to manage administrative rights rather than letting users easily log in as the root user. This is actually a good security measure. However, if you need to perform administrative tasks frequently it can get rather annoying. Here’s how you can set Ubuntu to not prompt for your password when using sudo.

Note: this is something that is not recommended if you are using your computer in a public place or at your work, as this will compromise the security of your data. You’re better off setting this at your home desktop where you are likely to trust more people.

Launch a terminal window and enter the following command:

# sudo visudo

Visudo is a tool used to edit the configuration file of sudo . The command will prompt your for your password. Enter it one last time. The configuration file will open in a text editor, most likely Nano. Scroll down to the end of the document and add the following line:


Replace username with the username of the user you want to allow a passwordless sudo. So if the user is calvin, you would enter:


Save and exit the file. Log out, log in as the user calvin and test out your new passwordless sudo.

15 thoughts on “How to stop Ubuntu from asking for your sudo password”

  1. Talk about circumventing security!
    Why not just run:

    sudo su

    in a terminal and do your root command tasks there. That way:
    1) You don’t have to sudo each command.
    2) You only enter your password once.

  2. This is about as boneheaded as running Vista with no security software at all. Why on Earth would you want to do this?

    Personally, I’m not a fan of Sudo, because using ones own user password just isn’t secure, IMO. I just use a different distro that doesn’t use Sudo by default.

  3. While there’s no way this is as dangerous as running Windows unpatched and without a latex suit, I gotta concur with the others: this seems a silly thing to be compromising. Especially since, as LL noted, above, Sudo already is a bit weak, security-wise. I understand the idea of having no Root account enabled for to be stumbled ‘pon, but if someone is far enough into my system that they’re typing terminal commands, aren’t they likely to have my sudo pwd?

    Anyway, it’s not like sudo blah blah is so hard to type. Further, I’ve noticed that the system doesn’t ask for the password again if the sudo commands are issued close enough together (say, sudo apt-get update [lots of processing….] sudo apt-get upgrade… [ditto…] whatever next.

  4. To those who question the wisdom of this –

    You’re absolutely right, under some circumstances.

    I ran Slackware (and only Slackware) from ’94 to ’99. I ALWAYS had a root terminal open, usually several. I would blindly issue commands not being aware of which terminal I was in. Smart? Maybe not. But not once did I do anything harmful to the system by mistake etc.

    Not everyone should follow the steps in this tutorial and disable the sudo password. But for those that want to know how, the info is provided.

    As Sukrit mentioned, this isn’t something you’d want to do on a computer at work or anywhere that other people can use it. But for a home desktop behind a firewall, for someone who knows what they’re doing, it can be very useful and time saving.

  5. Pingback: Ubuntu won’t ask for your sudo password anymore - Karol Zielinski’s Blog

  6. Its good to have this info out there. I do lots of admin tasks and some development on Ubuntu and this thing makes me crazy.

    Also, I guess you all watch to much 24 or something. The totally overblown computer security crazies have convinced otherwise sane people that there is some kind of a threat without 100s of security processes on their personal computers.

  7. Pingback: Ubuntu won’t ask for your sudo password anymore

  8. Im running Ubuntostudio 10.10. Doing you sudo visduo command bring up the document in Nano, but i see no way to save it. Is there svae command I dont know about?

  9. @BadAzzMike
    I am having the same issue with the saving. I noticed the commands at the bottom, and they are Ctrl commands… So Pressing Ctrl+X exits and will ask you to save before exit. It’s at that point that I don’t know what to do.


  11. Press ctrl+G to bring up the help:
    Scroll down:

    ^G (F1) Display this help text
    ^X (F2) Close the current file buffer / Exit from nano
    ^O (F3) Write the current file to disk
    ^R (F5) Insert another file into the current one

  12. Nicholas Pipitone

    I’m not sure why everyone is saying this supposedly a security flaw. Like, yes, I understand, if you’re setting up an apache server, you obviously want to make it difficult to escalate privileges if someone gets a shell, because spying on users is a lot worse than simply being able to edit html files. That’s why you lock it down with a separate user that can only access /var/www/html. But this overwhelmingly doesn’t apply in a home computer situation.

    Like, for a home computer, I obviously don’t care if someone else is at the terminal screwing with /bin, that means nothing to me. Literally the only thing that matters on a home computer is the data in /home/myusername, and that’s ironically one of the only parts of the computer that doesn’t require sudo. Like, the worst they could do with sudo is wipe my harddrive partitions, which is rather mild. Wipe my partitions for all I care, it’s only a minor 20minute nuisance. If my computer is compromised, it’s already gg anyway. Critically, what matters is accessing personal documents stored in /home. Even if someone wanted sudo on a home computer and didn’t already have it, it would be trivial to secretly edit the bashrc to open up a subshell containing a malware version of bash that will save my sudo password the next time I type it, after which they have sudo anyway.

Leave a Comment

Your email address will not be published. Required fields are marked *