This means you not prompted for your password when typing sudo …

Apart from ease of use, I’ve got a scenario where I’m calling a bash command from C# which requires sudo, so don’t want to be prompted for a password.

# switch to vim
# vim.basic
sudo update-alternatives --config editor

sudo visudo

# dave isn't prompted for password when typing sudo
# put at the end of the visudo file



If you make a mistake using sudo visudo and save it, it means you can’t use sudo anymore. It happened to me using nano as the editor, and I still have no idea how.

# terminal 1 get PID
echo $$

# terminal 2
pkttyagent --process PID_FROM_STEP_1

# terminal 1
pkexec vim /etc/sudoers

Here is an example of a clean visudo file from ubuntu20.04

Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d