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?

1
  • let me us know what things are you trying ? Dec 29, 2012 at 8:23

2 Answers 2

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.

1
  • Thanks for pointing on escaping chars, but the first parameter of the script must be relative path thanks to its author.
    – tijagi
    Dec 30, 2012 at 2:30
0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .