[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SOLARIS: su - user not passing cmd args



> Anything interesting in the output of "su - user -c set"?

Nope. They're not. That's the problem.

I found references to this in Sun's knowledgebase, but every one of them was
unanswered.

I found references to this in the Sun newsgroups, but every one of them said
'don't use "su - user -c cmd", use "su user -c "VAR=value cmd" instead, and
that using 'su - user' is fraught with danger.

I'd have thought that inheriting some random environment from whomever invoked 
the 'su user' would be moreso. But that's just me.

More weirdness:

su - user -c '/usr/bin/echo a b c' /usr/bin/echo d e f

Results in the *.profile* seeing the "/usr/bin/echo d e f" as it's 
"$0 $1 $2 $3" and the "/usr/bin/echo a b c" that runs in the su'd shell sees
*that* as it's "$0 $1 $2 $3".

Create a script called "showme1" that is the following one line:

  echo "0=$0" "1=$1" "2=$2" "3=$3"

Copy it to another script called "showme2"

then try this:

  su - usr -c 'showme1 a b c' showme2 d e f

Mike/

---------------------------------------------
http://www.valuenet.net



-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.