23

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.

5
  • 6
    You really do not want to do this. This is the way Windows is and then opens system to potential for virus or hackers to access system. wiki.ubuntu.com/RootSudo and (but this has never worked for me): xkcd.com/149
    – oldfred
    Nov 23, 2016 at 5:13
  • 2
    @oldfred Actually password-less sudo does not significantly weaken security. Once an attacker gains the ability to run programs as the unprivileged user, that attacker can install a key-logger to record the password at the next invocation of sudo and thereafter gain root privileges. You have to keep viruses/crackers out of the system entirely anyways, whether you use password-less sudo or not. Nov 23, 2016 at 6:31
  • @DepressedDaniel Suggesting sudo isn't essential concerning security is false information. Nov 23, 2016 at 7:04
  • 1
    @JacobVlijm It depends on the context. For a typical Ubuntu desktop user, it adds very little security to have a sudo password, in other contexts it may be more relevant. Nov 23, 2016 at 7:09
  • These questions give better answers for modern GUI apps using polkit instead of sudo askubuntu.com/q/98006/897087 askubuntu.com/q/3/897087 Feb 18, 2022 at 21:40

6 Answers 6

16
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).

12
  • 3
    So I changed it to "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" and restarted. But when I opened the app store and tried to install an app... it still asked me for a password. Nov 23, 2016 at 4:19
  • Type groups and check if your user is in the sudo group. If not, change %sudo into your user name and try again. If that doesn't work, then the prompt might not be related to sudo ... Nov 23, 2016 at 4:25
  • 1
    Sudu is in groups. I tried to add my username, but the appstore still asks for a password. Nov 23, 2016 at 4:37
  • Then I suspect the steps you took to disable the login password could've broken something. Nov 23, 2016 at 4:42
  • Its possible, I'm an absolute novice. Heres a screenshot of my edits, does something look broken? Nov 23, 2016 at 4:55
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.

1
  • Thank you! This worked. I wish I could disable it completely, but this is good too.
    – anton1980
    Apr 13, 2021 at 2:11
3
sudo nano -w /etc/sudoers

add NOPASSWD entry for your user:

yourusername ALL=(ALL) NOPASSWD: ALL
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.

2
  • Thanks but that didn't stop the ubuntu software store from still asking for a password when I try to install something. Nov 23, 2016 at 5:14
  • Helpful tip, but doesn't directly answer the user's question. Mar 26 at 3:13
0

Just type this command

echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers
1
  • 1
    I realize that this is a duplicate answer, but it's worth saving because it's easier to understand than the original.
    – karel
    Aug 25, 2023 at 7:26
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).

1
  • 1
    editing the sudoers file seems to remove the password prompts for everything except the appstore. When I try to install something via appstore it still asks me for a password. Nov 23, 2016 at 5:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .