Allow An Unprivileged User To Run A Certain Command With Sudo

By | May 15, 2012

First, you’ll need to use the visudo utility…

sudo visudo

This command safely opens up the /etc/sudoers file for you in your default editor. Let’s say you want to allow a user named “joe” to run a given command. You just need to add a line like this below (customize for your needs)

joe ALL=(ALL) NOPASSWD: /full/path/to/command

Now what if you want to restrict joe to only use that command within a given set of parameters or with only certain arguments? Well, just toss them in there too! Check this out:

joe ALL=(ALL) NOPASSWD: /full/path/to/command ARG1 ARG2