0

This question already has an answer here:

I want to make sudo configuration such that one user 'test' should have access to all commands,all hosts like root. But for specific commands like 'ls /root' password should not get promted.

I'hv checked other questions but not able to find solution..Can someone please help?

marked as duplicate by Gilles linux Dec 10 '15 at 23:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Your question is not very clear. You want that for some commands the password is requested and not for others? – LilloX Dec 10 '15 at 8:22
  • no, I want for some commands password should not be requested and should be rest of the commands. – AVJ Dec 10 '15 at 11:02
2

First create a command alias for the commands which can be used without password:

Cmnd_Alias PASSWORDLESS = /bin/ls /root, /bin/whatever

Next add the user:

test ALL=(ALL) ALL

And finally add the rule for the commands which are allowed without password:

test ALL=(ALL) NOPASSWD: PASSWORDLESS

The order is important, the NOPASSWD line must be below the other rule for the user.

Not the answer you're looking for? Browse other questions tagged or ask your own question.