Allow sudo access without passwords in Ubuntu


To give a specific user access to sudo without having to enter a password you have to edit the /etc/sudoers configuration file. For security reasons you should only edit the file using the visudo command.

In Ubuntu the following lines are placed at the bottom of /etc/sudoers by default. This gives your default user access to sudo as well as any other user in the admin group.

If you want to allow sudo access without passwords for all users in the admin group you can simply add the NOPASSWD option to this line and be done.

If you want to give a specific user sudo access without passwords, you will have to add an additional line for each user. These lines will conflict with the default admin line above so they must be placed at the end of the sudoers file. The reason for this is that sudo will handle contradicting configuration lines by giving priority to the line closest to the bottom of the file.

Add the following line to the end of the file, replace ‘ryan’ with your username.

Add a line for each user that you wish to have access.

For more ways to use and configure sudo have a look here.