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. That is the place to define access to the sudo command 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

Turn off sudo password for your accountTurn off sudo password for your account

Save your changes and exit the editor. Because of the installation for example, the editor is nano , so the article authors 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

Use sudo without passwordUse sudo without password

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. In fact, 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 reason as the annoying Windows User Account Control , which serves 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.

See more:

How to check sudo history in Linux
How to reset password for sudo in Debian
Linux SUDO error allows to run commands as root
20+ essential Linux security commands
The basic Linux commands everyone needs to know



Operate and exploit advertising by iCOMM Vietnam Media and Technology Joint Stock Company.
Adress: 99 Nguyen Tat Thanh, To 2, Khu 6, Thi tran Tan Phu, Tan Phu, Dong Nai.
Email: phuongtran2191@gmail.com | Tel: (+84) 984654960
Editor in chief: Tran Nha Phuong
Company: Lucie Guillot (Nha Phuong Tran)

Contact

INFORMATION RESEARCH LIMITAD
Responsible agency: Union of Science and High-Tech Production and Telecommunications (HTI)y
Copyright © 2022 iCOMM Tech JSC