Run sudo command without a password
-
Open
/etc/sudoers
withvisudo
editor, as if straight away edit/etc/sudoers
file with text editor, it won't validate the syntax.sudo visudo
-
Append this line
username ALL=(ALL:ALL) NOPASSWD:ALL
at the end of the/etc/sudoers
file/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