Why to edit the sudoers file
In the sudoers file the options are configured for the Sudo command use.
In some cases you want this options to be changed for some users.
In my case I wanted to execute docker commands ( which is running as root ) with sudo without having sudo prompting for the password.
I was configuring a remote shell command running via a SSH connection to execute docker commands. Something like pull the latest version from Dockerhub which I just build.
Since docker is running as root, and the user to execute is not ( which is a good thing ) the docker commands needs to executed with sudo.
Sudo is asking for a password and if you are executing the sudo command in a remote shell command the option to provide the password is not available.
And it's allso not something we want.
Therefore we can edit the sudoers file to change Sudo asking for the password for this specific user.
Steps to edit the sudoers file
- Run sudo Visudo
- Press Alt + l to navigate to the end of the file
- Add the line: yourspecificusername ALL=(ALL) NOPASSWD:ALL
- Press Control-O to save
- Press Control-X to quite