In this tutorial, we will learn how to enable sudo without asking for a password. In the Linux Operating system, we need to use sudo to access the root privileges for a non-root user. It can be inconvenient to enter the password whenever we use
Learn how to enable sudo without asking for a password
- Linux Operating System (Ubuntu, Debian)
- Access of Root User or Other User with Sudo privileges.
Edit the “/etc/sudoers” file. If you try to edit this file with any other editor then such as Vim editor, the system will not allow you to edit the file. To edit the file simply run the below command.
Now add the following line at the end of the file because the file is processed in order (sequence) so that the other permissions do not override.
username ALL=(ALL) NOPASSWD:ALL
username with your username which you want to allow sudo access without entering the password.
Now test the configuration which we have done is successfully working or not. Open a new terminal and run any command which requires
sudo privileges, such as
sudo apt update. Now this time it will not ask you for a password.
In this tutorial, we have successfully enabled sudo without password in Ubuntu/Debian/CentOS
If you guys have any queries related to this tutorial, Let me know in the comments.