To allow a user named sphinx
to run commands as root
using sudo
without being prompted for their password, add this snippet to /etc/sudoers
or to a file in /etc/sudoers.d/
:
sphinx ALL=(ALL) NOPASSWD:ALL
Interpreting the line left to right, this means:
- the user
sphinx
- whatever the identity of the current host
- can run, as any user
- without being prompted for their password
- any command.
The second ALL
isn't strictly necessary. It's a Runas_Spec
that lets the user run commands as any user using sudo
. Without it, they can only run commands as root
-- though from there, of course, they can run commands as any user with su
.
This snippet matches the one used in cloud-init
.