Allow any arguments for a given command with sudo

Posted by Mark L on Ask Ubuntu See other posts from Ask Ubuntu or by Mark L
Published on 2013-11-10T15:19:04Z Indexed on 2013/11/10 16:12 UTC
Read the original article Hit count: 234

Filed under:

I have the following sudo config entry which I added via sudo visudo:

mark ALL = NOPASSWD: /usr/bin/lxc-ls*

I can run lxc-ls with my user fine but I can't append any parameters without it demanding I prefix the command with sudo.

$ whoami
mark
$ lxc-ls
test-container
$ lxc-ls --fancy
lxc-ls: error: You must be root to access advanced container properties. Try running: sudo /usr/bin/lxc-ls

Any idea how I can edit via sudo visudo to allow for any argument after the command?

I don't want to prefix the command with sudo as I'm using a python library to execute the command and it's being funny about sudo prefixes.

© Ask Ubuntu or respective owner

Related posts about sudo