Bug#390910: [Pkg-shadow-devel] Bug#390910: login: Packaging arguments for su doesn't work as advertised

Ian Zimmerman itz at madbat.mine.nu
Tue Oct 3 18:26:29 UTC 2006


Nicolas> The arguments are supplied *to the shell*.
Nicolas> Do you agree in closing this bug?

Ok.

Nicolas> su root -c "$@" may be a replacement, but it will fail
Nicolas> sometimes.

That's what I started with ;-(  I had a script "suc" approximately
as follows:

exec su root -c "$*"

but of course that fails on a command like 

find . --name "*.foo"

because the subshell will expand the wildcard before passing it to find.
Before you suggest quoting by hand, that's just what I meant by "such a
pain".  You lose all the bash/readline/history benefits that way.

Any other way to execute a command as root (assuming I have the
privileges) without an intermediate shell?

-- 
She had a passion for anyone who could do anything really well.
...                "Not for an engineer, not for a technician!"
                    Mikhail Bulgakov, The Master & Margarita




More information about the Pkg-shadow-devel mailing list