Target users environment

Becker, Brian Brian.Becker at
Fri Sep 6 20:58:30 EDT 2002

How does this solve Robert's original problem?  He's trying to avoid logging
these script-based su's in the first place.  All sudo has added is an extra
layer of complexity.

Is there a reason why a '-' option couldn't or shouldn't be added to sudo?

Brian R. Becker
Unix System Administrator
McKesson Corporation
(916) 636-8785

-----Original Message-----
From: Matthew Hannigan [mailto:mlh at] 
Sent: Friday, September 06, 2002 8:00 AM
To: Robert Cross
Cc: sudo-users at
Subject: Re: Target users environment

Robert Cross wrote:
> Sorry if this is a RTFM question.
> We've got a lot of scripts that run as root that do
>  su - someuser "-c cd somedir; ${somesymbol}/someprogram"
> now these rely on the 'su -' part, i.e. inheriting the default enviroment
> of 'someuser'. Is there
> anyway to use sudo to do this?

Bit of FAQ this one.  The way to do the "su - .." thing is to ...
... do the "su - .." thing!!


     sudo "su - someuser '-c cd somedir; ${somesymbol}/someprogram'"

though it gets a bit hard to expand the ${somesymbol} AND match
that against a valid sudoers config line.

PS. Why do you have the -c in there?

PPS. That's one hell of a disclaimer that Scottish Courage tack
       onto your email.

sudo-users mailing list <sudo-users at>
For list information, options, or to unsubscribe, visit:

Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

More information about the sudo-users mailing list