[Server-devel] Fixing bash script bogosity - help?

pgf at laptop.org pgf at laptop.org
Tue Apr 28 12:20:08 EDT 2009


martin wrote:
 > On Tue, Apr 28, 2009 at 4:30 PM, Martin Langhoff
 > <martin.langhoff at gmail.com> wrote:
 > > On Tue, Apr 28, 2009 at 3:28 PM, Bert Freudenberg <bert at freudenbergs.de> 
 > wrote:
 > >> $ su root -c '/bin/echo "$@"' /bin/echo one two three
 > >
 > > Interesting - seems to work as
 > >
 > >    runuser root -c '/bin/touch "$@"' /bin/touch "one two" "thre\"ee"
 > >
 > > but for some reason it doesn't work on my script. Any ideas on how to
 > > apply this to the runuser line on the ejabberdctl script?
 > 
 > The plot thickens.
 > 
 > Both sudo and runuser do pass parameters to the shell, but no
 > parameter that looks like an option is accepted. So
 > 
 >   # this works
 >   runuser root -c '/bin/touch "$@"' /bin/touch "one two" "thre\"ee"
 >   # this does not work -
 >    runuser root -c '/bin/touch "$@"' /bin/touch "one two" -d

but this does:
    $ su root -c '/bin/touch "$@"' -- /bin/touch "one two" -d
    Password: 
    /bin/touch: option requires an argument -- 'd'

is there a reason to use runuser?  it doesn't look like it's
being used for anything su can't handle.

paul
=---------------------
 paul fox, pgf at laptop.org


More information about the Server-devel mailing list