[NTLUG:Discuss] Re: SuSE 9 or 9.1 PATH environment changes after su -- LSB and newer Red Hat

Chris Cox cjcox at acm.org
Mon Sep 13 15:45:19 CDT 2004


Bryan J. Smith wrote:
...
> E.g., Red Hat (Fedora Core 2) _has_ changed so:  
>   su   = launches a basic root path, appended with (current?) user path
>   su - = launches a "pure" root path
> 
...

> SuSE Linux 9.1, according to Steve's posts, is the opposite:  
>   su   = launches a "pure" root path
>   su - = launches a basic root path, appended with (current?) user path

This actually goes far back with SUSE.  "su" gives you a safe path,
whatever you define in /etc/login.defs for root.  Not sure if "pure"
is correct since you have control over it.

If you look at /etc/profile, you'll see that on SUSE that
the /sbin:/usr/sbin:/usr/local/sbin paths are set first with the
/etc/profile PATH afterwards (not an inherited PATH from the user, but
rather the normal PATH set by /etc/profile or earlier modifiers of
PATH).

So if my system's default user PATH is /bin:/usr/bin and my ccox PATH
is /usr/local/evil-stuff/bin:/bin/usr/bin, doing an "su -" as ccox
will result in /sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin for a PATH.
Remember, "su -" is a login... so you really don't inherit the PATH,
though you might get elements of the default PATH for all users as
setup by /etc/profile and earlier.

So, I would say:
Red Hat
    su   = (not sure, but sounds like they're striving to be more up-to-date)
    su - = root path just like a login.

SUSE
    su   = path as defined from /etc/login.defs or else a default safe path.
    su - = root path just like a login (which in SUSE's case includes the
           default user PATH after /sbin:/usr/sbin:/usr/local/sbin).

With the advent of profile.d on SUSE, other things may happen as well
on login depending on what is configured there.  This is where you would
make customizations to /etc/profile things... just add your script to the
/etc/profile.d directory.  Thus allowing SUSE to destroy /etc/profile
if necessary during an update (to alter some kind of variable, PATH or
otherwise).





More information about the Discuss mailing list