There is a command (say: mycommand) that we want to add to sudo for all users, but there is one specific command line option -i that we want to exclude. Complicating factor is that command line arguments can be combined, making it harder to build a regex or something. So we want to allow:
- sudo mycommand
- sudo mycommand -p -f something -w
- sudo mycommand -pf something -w
but not:
- sudo mycommand -i
- sudo mycommand -p -i -f something -w
- sudo mycommand -pif something -w
So far I have had mixed results, like incorrectly allowing "sudo mycommand -piw" or incorrectly blocking "sudo mycommand -pf something -w"
Any suggestions, other than writing a wrapper script?