How do I sudo without having to enter my password? [duplicate]

I believe the correct line is:

gandalf ALL=(ALL) NOPASSWD: ALL

Put it in the end of the file - replace gandalf with the appropriate username. (To edit the file, run the command sudo visudo.)


I use the sudo group and have:

%sudo ALL=NOPASSWD: ALL

There is one note to mention. That line should be at end of the /etc/sudoers file.

Why: because some configuration lines from /etc/sudoers overwrite our line.

gandalf ALL=(ALL:ALL) NOPASSWD: ALL