How to stop Ubuntu from asking for your sudo password

by Sukrit Dhandhania on May 27, 2009

Linux Security

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:

username ALL=NOPASSWD: ALL

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

calvin ALL=NOPASSWD: ALL

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

  • Michael

    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.

  • LinuxLover

    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.

  • Mihc

    You might as well run windows

  • gyffes

    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.

  • http://www.simplehelp.net Ross McKillop

    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.

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

  • nanohead

    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.

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

  • BadAzzMike

    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?

  • Fujin

    @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.

  • BRIAN

    THE ONLY WAY I KNOW HOW TO DO IT COMPLEATLY IS TO INSTALL KUSER IN KDE AND EDIT ROOT PASSWORD THEN LEAVE BLANK AND CLICK OK