Linuxtipstricks – Just another /linux/blog

March 21, 2009

How to change sudo to not ask for your personal password

Filed under: user tipstricks — Antonio Portuesi @ 4:13 pm

On any default Ubuntu box, any task which requires root (or Administrator) privileges runs a program called sudo (or the graphical version, gksu) to run a helper program in a privileged mode.
By default, for security reasons, this program will ask you to input your personal password. When you make many settings changes on your system (or need to run applications as root), each password prompt can get rather annoying.
This tip will show you how to configure sudo to allow a specific user to run commands as root (or any other user you define) without prompting for a password.

The sudo program saves its configuration information in the text file /etc/sudoers. So you should edit this file:

user@pc:~$ sudo nano /etc/sudoers

and add the following line:

#USER# ALL=NOPASSWD:ALL

Replace #USER# with the username of the user you wish to add. E.g. if the username was bill, insert a string like that:

bill ALL=NOPASSWD:ALL

Now you will not have to give Ubuntu the password when you use sudo.

Advertisements

3 Comments »

  1. I been searching edlessly trying to do this. You got the method down pat. I was trying to create a start up script that would update linux automaticaly. But i needed to use sudo, and of course i couldnt use the script without the naggy ol password promt. Used his technique now my script works 😀 thanks!

    Comment by Mike — June 29, 2012 @ 11:01 am | Reply

  2. This is outdated for 12.10.

    Please use this answer i found in askubuntu http://askubuntu.com/a/203212/10591

    Your main user is member of group ‘sudo’. Default settings is to ask your password in order to perform any activity which requires some privilegies.

    in order to change it, you need to run in a terminal:

    sudo visudo

    and change this line:

    %sudo ALL=(ALL:ALL) ALL
    for this line:

    %sudo ALL=(ALL:ALL) NOPASSWD: ALL
    save the changes and close your session to have your system taking the changes.

    Comment by kimsia (@SimKimSia) — December 27, 2012 @ 2:46 pm | Reply

  3. For 12.10, if you want to give only specific users this privilege you can just change the user’s line with the new syntax.

    So to only give the user “admin” this privilege, change the admin user’s line to:
    admin ALL=(ALL:ALL) NOPASSWD: ALL

    Comment by Ric — January 3, 2014 @ 9:56 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: