Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 107391 - path after su -l different than after normal login
path after su -l different than after normal login
Product: Red Hat Linux
Classification: Retired
Component: coreutils (Show other bugs)
All Linux
medium Severity low
: ---
: ---
Assigned To: Tim Waugh
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2003-10-17 13:42 EDT by Need Real Name
Modified: 2007-04-18 12:58 EDT (History)
0 users

See Also:
Fixed In Version: 5.0-20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-10-21 05:42:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2003-10-17 13:42:37 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
su uses one hardcoded default path for root and one for other users. These
default paths are different from the default paths used by login. After running
"su -l <user>," I have a different path than I would have if I simply logged in
as <user>.

One problem with this is that the paths defined by su contain "local"
directories after standard directories. For example,
"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin..." instead of
"/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin...". These default paths
also interfere with path munging that may normally be done in /etc/profile or
other login shell configuration files. For example, /etc/profile as included
with RH9 will add /usr/local/sbin to the front of the path (if it isn't already
in the path). This addition will be made after /usr/sbin and /sbin have been
added and so /usr/local/sbin will occur before "system" sbin paths.

It seems that this behavior is actually defined in a patch that is included in
the core-utils (and sh-utils before su was split out of sh-utils) source rpm:
sh-utils-1.16-paths.patch (a patch from RH 4.2). Both su and login would
normally try to use _PATH_DEFPATH and _PATH_DEFPATH_ROOT in /usr/include,
although it seems that this has been abandoned.

su -l and login should probably use the same default paths. At the very least,
su -l should place "local" paths before system paths so that sysadmins can
"override" system installed software and obtain the overridden version not only
through normal login channels but also through su -l.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. su -l
2. echo $PATH
as opposed to
1. login from a terminal as root
2. echo $PATH

Actual Results:  
$ su -l
# echo $PATH

login: root
# echo $PATH

Expected Results:  
$ su -l
# echo $PATH

Additional info:
Comment 1 Tim Waugh 2003-10-18 05:08:32 EDT
Looks like bug #102567.
Comment 2 Need Real Name 2003-10-20 12:16:24 EDT
It does look like bug 102567.

A couple of elements may be useful:
The fact that /etc/profile does already handle /usr/local/sbin for root
(although it may not handle /usr/local/bin for anyone yet)

The fact that _PATH_DEFPATH and _PATH_DEFPATH_ROOT have been abandoned as a way
of synchronizing default paths.

Otherwise, sorry I missed the RHEL beta bug.

Note You need to log in before you can comment on or make changes to this bug.