}

How to execute sudo with no password

Created:

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 NOPASSWD.

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.

  1. As an administrator Execute visudo to open the sudoers file

  2. You can add a new line near the other users or at the end of the file with tutorials_username ALL=(ALL) NOPASSWD:ALL

  3. Now save the file and quit with wq ( 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 sudo_nopass

Open /etc/sudoers with visudo and append a new line with:

%sudo\_nopass ALL=(ALL:ALL) NOPASSWD:ALL
if(typeof \_\_ez\_fad\_position != 'undefined'){\_\_ez\_fad\_position('div-gpt-ad-tutorials\_technology-medrectangle-3-0')};

Next, you can add users with the command:

usermod -a -G sudo\_nopass tutorials\_username

That's all! Remeber to leave comments!if(typeof __ez_fad_position != 'undefined'){__ez_fad_position('div-gpt-ad-tutorials_technology-medrectangle-4-0')};