[NTLUG:Discuss] Re: SuSE 9 or 9.1 PATH environment changes after su

Chris Cox cjcox at acm.org
Mon Sep 13 11:10:08 CDT 2004


Bryan J. Smith wrote:
> On Sat, 2004-09-11 at 14:26, Stephen Davidson wrote:
> 
>>steve at blue:~> echo $PATH
>>/home/steve/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/jre/bin
>>steve at blue:~> su
>>Password:
>>blue:/home/steve # echo $PATH
>>/usr/sbin:/bin:/usr/bin:/sbin:/usr/X11R6/bin
>>blue:/home/steve #
>>Paths are different.
> 
> 
> Most of my experience is with SLSS/SLES 8.
> Is this a change in 9?
> 
> If so, maybe SuSE is not using an alias, but another approach.
> The alias is just the most common I've seen (e.g., Mandrake)
> 
> As such, on SuSE Linux 9.x, what do you get from:  
>   $ su -
>   # echo $PATH
> 
> As well as,
>   $ which su

Su (on SUSE) reads in /etc/login.defs where you can set the root
PATH.

> 
> Just curious.  Thanx.
> 
> -- Bryan
> 
> P.S.  I consider changing the PATH by default quite "broken" from a
> traditional UNIX/Linux standpoint.  It would _screw_up_ a lot of the
> usage/scripts I use.
> 

While certainly true of old Unix... this is not true of new Unix.
The standard, for security reasons (hopefully obvious), is for an
su to root to NOT inherit the user's PATH.  SUSE and Solaris (and
probably any SVR4) provide mechanisms by which root's path can be
set when somebody does an "su".

It's easy to say that we should stick with the insecure solution
(ala Red Hat and old Unix), but it is in fact bad practice.

For example:

1. user places . (could be any path though) at the head of their path.

2. calls over somebody with the root password.

3. Asks, "Could you remove a lock file (or some other innocuous thing)?"

4. root does, su rm -f <path-to-lockfile>

However, what root doesn't realize is that he actually ran
the binary executable called rm in the current directory (or any
directory the user chooses really) which in turn created a setuid shell
for the user.  And the user says a big "THANK YOU!" to the root.

Red Hat isn't alone is the behavior... AIX still functions the old
way.  Solaris doesn't, neither does HPUX (which is also an old variant
like AIX).  Tru64 Unix implements a wheel approach (optional in AIX
as well), so normal users can't su to root ordinarily.

So as far as the major commerical Unix vendors, just AIX (but
can be fixed thru smit).








More information about the Discuss mailing list