I can bet that we are all familiar with sudo. It is a utility available in most Linux distributions and being adopted by those that haven’t implement it yet. Therefore, if you are a regular Linux user, sudo is a must-use tool.
Sudo is a Unix utility that allows trusted users to run commands with the privileges of another user. Its most common use is to run commands as the root user, which is set by default.
However, to invoke sudo, the user calling the sudo command must be a group of the sudoers managed by the sudoers file in (/etc/sudoers/). However, the group name of the sudoers group may differ based on the distribution you are using.
Out of the box, once a user invokes sudo, they will be required to provide a password before execution. That is one of the security mechanisms of the sudo tool as it can be harmful if incorrectly.
However, if you often run loads of commands in your terminal, it can be very exhausting to keep typing your passwords every time you invoke sudo. Similarly, if you are running scripts that require sudo, having a password is really not the way to go. That is where the concept of password-less sudo comes in.
In this tutorial, we shall focus on setting up sudo in a way that does not require you to enter a password.
CAUTION: Due to the nature of the tool and its caching mechanism, running a command like sudo without a password can have security concerns. Please be careful when enabling this option.
Enable Password-less Sudo
To set up password-less sudo, all we need to do is edit the sudoers file and add a few entries.
Start by editing the sudoers file with the command:
We recommend editing the sudoers file with visudo as it verifies the edits and does not save changes if errors occur.
In the sudoers file, add the following entries.
Save the file and close. It is good to note that the changes affect all the users of the sudo group.
To set password-less sudo on a specific user, we can add the entry as:
The above entry sets a password-less sudo for the user linuxhint.
For this guide, we looked at setting a password-less sudo for a specific user or all members of the sudo group. Use this functionality with caution as it may lead to security flaws.
If you liked the guide, share it with friends.