Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to allow a user to run a command using sudo, but prevent them from adding any arguments to the command?

For example, if I want a user to be able to run:

/sbin/mii-tool

but not:

/sbin/mii-tool -r

Thanks.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

The Fine Manpage sez:

you can specify "" to indicate that the command may only be run without command line arguments.

So in your case, you'd probably do something like:

ALL ALL=(root) /sbin/mii-tool ""

(Probably throwing in a NOPASSWD: for convenience)

share|improve this answer
    
Nice catch, had a hard time finding that myself –  Hyppy Jul 31 '11 at 3:41
1  
man sudoers, first result for 'argument'. Rocket science it ain't. –  womble Jul 31 '11 at 3:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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