The “Sudoers” administrator file stores the “sudo” command line tool configuration. It generally asks for the administrator password for authentication while performing any task in the system. But for a long time, the user is irritated by typing the “sudo” password again and again for the system settings.
To address this issue, the user can configure the “Sudoers” file so that commands can be executed without requiring the user to enter their password.
This guide shows the complete procedure to edit the sudoers file and enable NOPASSWD for a user, all commands.
- How to Enable NOPASSWD for User in a Sudoers File
- Step 1: Access the “Sudoers” File
- Step 2: Enable the “NOPASSWD” Configuration
- Step 3: Verify the Changes
How to Enable NOPASSWD for User in a Sudoers File
The following steps are helpful for enabling the “NOPASSWD” configuration for a user on all commands.
Step 1: Access the “Sudoers” File
First, open the “Sudoers” configuration file with the help of the “sudo” command in the “vi” or the default text editor “nano”:
$ sudo visudo
Step 2: Enable the “NOPASSWD” Configuration
Scroll down the “sudoers” file and navigate to the end of it. Add the following lines in it for the user, i.e., “itslinuxfoss”:
$ itslinuxfoss ALL=(ALL) NOPASSWD:ALL
Press “Ctrl+S” to save and “Ctrl+X” to exit it.
Step 3: Verify the Changes
For the verification use the “update” command in the terminal with “sudo”. It will definitely run without a password as shown below:
$ sudo apt update
The above command is executed without asking for the root user password.
In Linux, the built-in “sudo” command asks the superuser password to make amendments to the system. Append the “username ALL=(ALL) NOPASSWD:ALL” in the sudoers file to execute the “sudo” command without a password. This guide has demonstrated a detailed view of the sudoers file, enabling NOPASSWD for a user.