Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have one script to allow for one user to run. The string calling it from the command line looks like

./script path/to/folder -a option='value'

When I try to add it to the other commands in Cmnd_Alias line, sudo blames sudoers file for incorrect syntax. How can I set such commands properly?

share|improve this question
    
let me us know what things are you trying ? –  Rahul Patil Dec 29 '12 at 8:23

2 Answers 2

A command alias definition looks like this:

MyAlias = /absolute/path/to/script /absolute/path/to/folder -a option\='value', \
          /absolute/path/to/script /absolute/path/to/folder -a option\='othervalue'

Note the backslash before the = sign: you must escape characters that have a special meaning (,:=\). The backslash at the end of the first line means that the alias definition continues on the next line.

Note that ./script and path/to/folder should be absolute paths. You can't know what the current directory will be when someone invokes sudo.

share|improve this answer
    
Thanks for pointing on escaping chars, but the first parameter of the script must be relative path thanks to its author. –  tijagi Dec 30 '12 at 2:30

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.