# How to Setup Passwordless Sudo for a Specific User

> URL: https://www.atlantic.net/vps-hosting/how-to-setup-passwordless-sudo-for-a-specific-user/ | Published: 2020-06-11 | Updated: 2023-11-25 | Author: Hitesh Jethva

In a Linux system, the root user is a superuser that has permission to access everything on the server. A standard user account only has limited privileges and can run only specific commands on the system.

The sudo command elevates a standard user account, granting root access to the system. Every time you sudo a sudo command you will be prompted for the sudoer password, which can become repetitive. However, there is a great way to securely configure a passwordless sudo account

In this tutorial, we will show you how to set up Passwordless Sudo in Linux.

## Step 1 – Configure Passwordless Sudo For a Specific User

If you want to allow a user named vyom to execute sudo without a password, edit the /etc/sudoers file:

```
nano /etc/sudoers
```

Add the following line at the end of the file:

```
your_username ALL=(ALL:ALL) NOPASSWD:ALL
```

For example:

```
Atlantic-Admin ALL=(ALL:ALL) NOPASSWD:ALL
```

Save and close the file.

Then, run any superuser command with sudo:

```
sudo fdisk -l
```

You don’t need to provide any password after running the above command.

## Step 2 – Configure Passwordless Sudo For a Specific Group

If you want to allow a member of a specific group named www-data to execute sudo without a password, edit the /etc/sudoers file:

```
nano /etc/sudoers
```

Add the following line at the end of the file:

```
%www-data  ALL=(ALL:ALL) NOPASSWD:ALL
```

Save and close the file when you are finished.

## Step 3 – Configure Passwordless Sudo For All Users

If you want to allow all users to execute sudo without a password **(note: this is only advisable in test systems and should never be used on production workloads)**, edit the /etc/sudoers file:

```
nano /etc/sudoers
```

Find the following line:

```
%sudo   ALL=(ALL:ALL) ALL
```

Replace it with the following line:

```
%sudo   ALL=(ALL:ALL) NOPASSWD:ALL
```

## Step 4 – Configure Passwordless Sudo For Specific User to Execute Only Specific Command

If you want to allow a specific user named vyom to execute only “fdisk -l” command  without password, edit the /etc/sudoers file:

```
nano /etc/sudoers
```

Add the following line at the end of the file:

```
your_username  ALL=(ALL:ALL) NOPASSWD: /sbin/fdisk -l
```

Save and close the file when you are finished.

Now, only the user can only run the “fdisk -l” command without a password.

## Conclusion

In the above guide, you have learned how to configure passwordless sudo for a specific group, specific user and all users. Ready to get started with Passwordless Sudo in Linux? Get [VPS Hosting](https://www.atlantic.net/vps-hosting/) from Atlantic.Net today!

Learn more about our [VPS hosting](https://www.atlantic.net/vps-hosting/) services and [Virtual private servers.](https://www.atlantic.net/vps-hosting/)
