27

I know how to create a command which a given user can execute via sudo. I have a given command I want to allow any user to be able to execute via sudo without entering a password. What would I put in my /etc/sudoers file in order to make that happen?

Josh
  • 9,398

2 Answers2

27

A section like this in your sudoers is probably what you want.

Cmnd_Alias NAMEOFTHIS=/usr/bin/program
ALL ALL=NOPASSWD: NAMEOFTHIS
Zoredache
  • 133,737
21

You might consider the SUID bit. Certain programs require root privileges and use the SUID bit, such as passwd.

If sudo is the better choice for you, you could use:

ALL ALL=NOPASSWD: /path/to/command
Warner
  • 24,174
  • 2
  • 63
  • 69