1

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?

  • let me us know what things are you trying ? – Rahul Patil Dec 29 '12 at 8:23
1

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.

  • 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
0

Script can be specified without parameters. http://forums.gentoo.org/viewtopic-p-7121802.html?sid=940bd372c7ebd5c9613fc318514c1d65#7121802

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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