Ubuntu 18.10: sudo without password

This article will describe how to omit sudo password. This will enable scripts with sudo be automated.

Table of Contents

1 Omit sudo password

Run visudo and edit /etc/sudoers. This needs sudo password yet.

$ sudo visudo
[sudo] password for hiroom2:

Add "NOPASSWD:" at sudo group.

--- /etc/sudoers.orig   2018-10-22 13:01:34.242733648 +0900
+++ /etc/sudoers        2018-10-22 13:02:07.950381907 +0900
@@ -23,7 +23,7 @@ root  ALL=(ALL:ALL) ALL
 %admin ALL=(ALL) ALL

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

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

After reboot, you can run sudo without password.