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

Bug#69090: strange su / which / apt behaviour

On Sun, 13 Aug 2000, Jens Taprogge wrote:

> Package: general
> Version: potato
> I am experiencing some strange behavior when I su to root: Which seems to be
> looking for things in the $PATH that is defined for my normal user account
> instead of the superuser account:
> $ su
> # which ldconfig
> # echo $PATH
> /usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/local/linux/bin:/usr/bin/X11:/usr/games
> # ls /sbin/ldconfig
> /sbin/ldconfig
> #

You are looking for "su -".

>From the su man page:
       su  is used to become another user during a login session.
       Invoked without a username, su defaults  to  becoming  the
       super  user.   The optional argument - may be used to pro-
       vide an environment similiar to what the user would expect
       had the user logged in directly.

> Now when I use sudo things seem to be normal:
> $ sudo which ldconfig
> /sbin/ldconfig
> $
> On the other hand:
> $ sudo -s
> # which ldconfig
> #

sudo gives you only root permissions, but you aren't logged in as
root. That means your PATH is set to the PATH of your user account.

> Best Regards
>   Jens


A "No" uttered from deepest conviction is better and greater than a
"Yes" merely uttered to please, or what is worse, to avoid trouble.
                -- Mahatma Ghandi

Reply to: