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

Re: su and environment.



Thank You for Your time and answer, Bob:

> > $ su -c 'abc' -l anotheruser
> > 
> > but it returns
> > 
> > -su: abc: command not found
> > 
> > The abc is in the anotheruser's path, but it seems option '-l' does
> > not work here.
> > 
> > How I can accomplish the goal (without manually specifying complete
> > path)?
> > 
> The above command line worked for me.  What system are you using,
> which shell?

I do believe You - recently I had another strange experience and again
w/ bash's 'if' construction like this:

if [ "$a" == --help ]

- in one Debian 5 it worked, another - not!

I use Debian 5 mixture of stable and testing - all updated up-to-day.

Both users use

/bin/bash

version 3.2-4.
 
> Is this other user's path really getting set?  Is 'abc' executable and

No. And here the question arises, Why? As I do understand the su
manual. it says that option '-l' helps to load his (another_user's ENV).

> is the content runable (in other words, if it's a script and it begins
> with '#!/bin/bash', is bash really in /bin, or if it's binary, is the
> binary runable for the system you're on)?

Yes, it is executable - it runs just fine if I do:

su - another_user

and then in its shell run the

abc

w/o specifying the path and the abc is not in CWD.


Reply to: