sudo is a program that allows a user to run programs with the security privileges of another user. If no user is specified when running the command, it will try to run the other program as root, or the superuser. By default, running sudo will prompt for the superuser password, as in the following example;

$ sudo vi /etc/resolv.conf

 We assume you have received the usual lecture from the local System
 Administrator. It usually boils down to these three things:

 #1) Respect the privacy of others.
 #2) Think before you type.
 #3) With great power comes great responsibility.


While this is good for security reason, normal users would want to avoid the password prompt completely, especially if they are just running it on a desktop.

To enable passwordless sudo, one need to edit the /etc/sudoers file. This can be done by directly editing the file using your favorite editor as the following;

This method is known to cause problems with Ubuntu. Consider using the second method.

$ sudo vi /etc/sudoers

or by using a dedicated program just for this by issuing the following command;

$ su -
# visudo

In editing the file, there are 2 options to enable passwordless sudo, which is to allow by group, or by user.

To everyone in the group mygroup to be able to use sudo without password, add the following line;


Adding the following line will allow the user username to use sudo without password