0

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?

AVJ
  • 505
  • 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 08: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

1 Answers1

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.

Lambert
  • 12,680