In this tutorial, we are going to configure the command
sudo to avoid asking for a password every time you use it. We will explain to alternative ways to solve this issue. The first way is to add a particular user to the sudoers with
NOPASSWD options, the second way is to add a group with the
Allowing a user with no password
You can use any text editor to open
/etc/sudoers, however, we recommend to use
visudo since it will check for syntax errors.
- As an administrator Execute
visudoto open the
- You can add a new line near the other users or at the end of the file with
tutorials_username ALL=(ALL) NOPASSWD:ALL
- Now save the file and quit with
means escaper key).
Now you will be able to execute sudo with the
tutorials_username on your system. Change
tutorials_username to the user you need to add sudo without a password prompt.
Alternative way: Using a group
You can also have a group with no password, let's call that group
/etc/sudoers with visudo and append a new line with:
%sudo_nopass ALL=(ALL:ALL) NOPASSWD:ALL
Next, you can add users with the command:
usermod -a -G sudo_nopass tutorials_username`
That's all! Remeber to leave comments!