Skip to content


How to stop Ubuntu from asking for your sudo password

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.

Posted in Linux, Security.

Get Simple Help tutorials just like this one in your email inbox every day - for free! Just enter your email address below:

 

You can always opt out of this email subscription at any time.

8 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Michael says

    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. LinuxLover says

    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. Mihc says

    You might as well run windows

  4. gyffes says

    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.

  5. Ross McKillop says

    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.

  6. nanohead says

    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.

Continuing the Discussion

  1. Ubuntu won’t ask for your sudo password anymore - Karol Zielinski’s Blog linked to this post on May 28, 2009

    [...] on: simplehelp.net               [...]

  2. Ubuntu won’t ask for your sudo password anymore linked to this post on August 17, 2009

    [...] on: simplehelp.net var addthis_pub = ”; var addthis_language = ‘en’;var addthis_options = ‘email, favorites, digg, [...]



Some HTML is OK

or, reply to this post via trackback.