How to use sudo without password in Linux

If you're the only one using your Linux computer, why let it keep asking for passwords? Let's see how you can use sudo without having to enter your password every time through the following article.

Note : This article will see how to disable sudo password in latest Ubuntu release. Process details may differ in other distributions.

Edit file sudoers

To disable password checking when using sudo for your account, you must edit the 'sudoers' file. This is where the access to the sudo command is specified for each user account or user group. However, it's best not to try to edit the file directly. Instead, run your favorite Terminal and type:

sudo visudo

Turn off sudo password for your account

To prevent sudo from asking you for a password, first check if there are any existing rules with your alias. If so, please change it as shown in the section below. If not, go to the end of the file and create a new rule there. It should look like this:

USERNAME ALL=(ALL) NOPASSWD:ALL

For the alias in the example, this rule is:

ducklord ALL=(ALL) NOPASSWD:ALL

How to use sudo without password in Linux Picture 1How to use sudo without password in Linux Picture 1

Save your changes and exit the editor. Since the installation examples, the nano editor, writer should have used Ctrl + O , followed by Ctrl + X .

Use sudo without password

That's all you have to do. From now on, sudo will no longer ask for your password. Test it with a command like sudo apt update or by installing an application with sudo apt install as test, for example:

sudo apt install links

How to use sudo without password in Linux Picture 2How to use sudo without password in Linux Picture 2

Don't turn off sudo passwords for everyone!

If you are sharing your computer with others and want to help them out with the hassle of having to enter a password whenever they use sudo, don't do so. Actually, there should be only one primary user with sudo privileges.

Sudo is no longer considered as a security measure against users with local access to hardware. It's not difficult to reset root password if you have local access to a Linux installation. Instead, it's there for the same reasons Windows annoying User Account Control, acting as an ultimate layer of protection between users, computers, and potential chaos, because a wrong command could This results in deletion of all data, destruction of settings or unintended sharing of personal information.

Disabling a sudo password is only good for those who have a good experience with the Linux command line and are the only user on their computer.

It should be emphasized that this will remove this last protective barrier between users and their own bugs. The article strongly recommends that you also back up your entire system and all data before doing so.

  1. How to check sudo history in Linux
  1. How to reset password for sudo in Debian
  2. Linux SUDO error allows to run commands as root
  3. 20+ essential Linux security commands
  4. The basic Linux commands everyone needs to know
4.1 ★ | 104 Vote