Skip to main content
Allowing passwordless sudo removes an important security layer. Only apply this to trusted user accounts on machines you control.
1
Open /etc/sudoers with visudo
2
Always use visudo to edit the sudoers file — it validates the syntax before saving, which prevents locking yourself out.
3
sudo visudo
4
Add the NOPASSWD entry
5
Append the following line at the end of the file, replacing kc with your actual username:
6
# 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

@includedir /etc/sudoers.d
kc      ALL=(ALL:ALL) NOPASSWD:ALL
7
Test the configuration
8
Open a new terminal window and run a command that requires root privileges:
9
sudo apt-get update
10
You should not be prompted for a password.

Build docs developers (and LLMs) love