How to setup passwordless `sudo` on Linux?

EDIT thanks to medina’s comment: According to the man page, you should be able to write

ALL            ALL = (ALL) NOPASSWD: ALL

to allow all users to run all commands without a password.


For reference, I’m leaving my previous answer:

If you add a line of the form

%wheel         ALL = (ALL) NOPASSWD: ALL

to /etc/sudoers (using the visudo command, of course), it will let everyone in the group wheel run any commands without providing a password. So I think the best solution is to put all your users in some group and put a line like that in sudoers – obviously you should replace wheel with the actual group you use.

Alternatively, you can define a user alias,

User_Alias     EVERYONE = user1, user2, user3, ...

and use that:

EVERYONE       ALL = (ALL) NOPASSWD: ALL

although you would have to update /etc/sudoers every time you add or remove a user.

Leave a Comment