If the user doesn’t have a password set or your just tired of being prompted everytime you use sudo, heres the solution.

Edit the line that defines the group/user in the sudoers file to look like this (more here):


This might be nice if your are using only public/private keys for your users and so a:

passwd -l username

can be used to disable/lock the users’ password (this only means they can’t possibly use a password to login, it does not mean they can’t log in).

If this stands the case for all ssh logins, you can also ensure:

PasswordAuthentication no

is defined in your sshd_config. Security br0. It’s awesome.

PS: In Gentoo, and I think OSX, it seems the sudoers file has the “wheel” group already setup with a NOPASSWD, making your only task to add your user to that grp through a:

usermod -G wheel username

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.