[sudo-users] Running as a user other than root

Michael Potter pottmi at gmail.com
Thu Feb 8 11:42:15 EST 2007

On 2/8/07, Stephen Carville <stephen at totalflood.com> wrote:

> sudo -u does not run the login scripts like profile and .bash_login so
> it inherits the PATH of the original login user not the runas user.  Try
> this and you'll see what I mean:
> $ echo $PATH
> $ sudo -u db2sds echo $PATH

That would not be a good test as $PATH will get evaluated before sudo runs.

Maybe something like this would be a good demonstration:

sudo -u db2sds bash -c 'echo $PATH'

the single quotes will prevent $PATH from being evaluated in this shell.

More information about the sudo-users mailing list