Steps to run a sudo command without a password
-
Open
/etc/sudoerswithvisudoeditor, as if straight away edit/etc/sudoersfile with text editor, it won’t validate the syntax.sudo visudo -
Append this line
username ALL=(ALL:ALL) NOPASSWD:ALLat the end of the/etc/sudoersfile/etc/sudoers# 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 kc ALL=(ALL:ALL) NOPASSWD:ALL -
Open a new terminal window and test the command with root privileges
sudo apt-get update
Last updated on
