Sudo no password

Ubuntu Privilege: Sudo no password

Let all sudo user without typing any password

You can edit /etc/sudoers to change your Sudoer privileges

sudo vim /etc/sudoers

Add NOPASSWD to the sudo setting

# Original
%sudo   ALL=(ALL:ALL) ALL

# Change
%sudo   ALL=(ALL:ALL) NOPASSWD:ALL

Allow a specific account without sudo password

If all the sudo are all no need to type their password to verify their account. It will have some security issue.

So you can allow only some specific accounts can run the sudo command without typing any password.

You can set the account in front of the NOPASSWD setting

ALL=(ALL) NOPASSWD: ALL

Edit the /etc/sudoers file and add the following setting

# File: /etc/sudoers
#includedir /etc/sudoers.d

<account name> ALL=(ALL) NOPASSWD: ALL

Allow a specific group without sudo password

If there are a lot of different accounts need the sudo without typing any password. It will be annoying to set every account into the /etc/sudoers file.

So we can allow a specific group can use the sudo without typing any password. Then we can only add that user to this group to have the same privileges.

After then, the only thing that we need to do is to control the group account list.

Create a new group that allow sudo without typing any password

If the group name is sudoers-no-password-group, then we can run the following command to create this group.

groupadd sudoers-no-password-group

Setting the specific group without type sudo password

Edit the /etc/sudoers file and add the following setting

# File: /etc/sudoers
%sudoers-no-password-group ALL=(ALL:ALL) NOPASSWD:ALL

Add new user to this special group that without type sudo password

sudo adduser

sudo adduser kejyun sudoers-no-password-group

After then, you can only add a new user to this group to allow the user to run the sudo command without typing any password.

Reference