26

Whenever I try to install a program I get a password authentication prompt asking me to punch in my password. I would like to know how to disable this.

I tried to google it and most of the stuff I find related to the login password, which isn't an issue for me as I disabled it at startup.

What I need to get rid of is the password prompt for installing and uninstalling stuff.

7 Answers7

21
sudo nano -w /etc/sudoers

(and enter your password one last time). Then use the editor to change the line that says:

%sudo  ALL=(ALL) ALL

into:

%sudo  ALL=(ALL) NOPASSWD:ALL

or even:

%sudo  ALL=(ALL:ALL) NOPASSWD:ALL

(to allow assuming any group as well as any user).

DepressedDaniel
  • 681
  • 4
  • 10
12

Type sudo visudo and this screen appears:

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset, timestamp_timeout=120
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:$

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification

The first command Defaults env_reset, timestamp_timeout=120 has been modified with a timeout of 120 minutes between having to enter sudo password. The normal default is 5 minutes. Although you can change this to a very large number you will still have to enter it once per boot.

3
sudo nano -w /etc/sudoers

add NOPASSWD entry for your user:

yourusername ALL=(ALL) NOPASSWD: ALL
damadam
  • 2,873
Arun VC
  • 31
1

Just type this command

echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers
1

By default ubuntu logs you in as a non root user for the O/S safety. It's there for a reason so that anybody who is new cannot mess up with the O/S itself accidently. In case you don't want to be prompted for password there is another way

sudo su

now you are root. But be very careful in terms of anything you are doing.

Ashu
  • 4,004
0

Here's a super simple answer for people new to Linux:

  1. Open the default Text Editor. You can find it by searching for "Text Editor": Ubuntu Search for "Text Editor"

  2. Open New Document: Open New Document

  3. Go to "Other Locations" and choose "Computer": Other Locations

  4. Navigate to etc folder: etc folder

  5. Choose the sudoers file

  6. Find the line that says %sudo ALL=(ALL) ALL or %sudo ALL=(ALL:ALL) ALL

  7. Change it to %sudo ALL=(ALL) NOPASSWD:ALL or %sudo ALL=(ALL:ALL) NOPASSWD:ALL

0

The password is required because it's using sudo to run the actual installation as root.

You may be able to address this by modifying:

/etc/sudoers

to allow it to run apt-get and dpkg without a password.

See:

https://help.ubuntu.com/community/Sudoers

Run apt-get without sudo).