[Top][All Lists]

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

Re: a possible su bug...

From: Bob Proulx
Subject: Re: a possible su bug...
Date: Sun, 10 Jun 2001 20:45:24 -0600

> 5.7 root->sjrd1# su - smuser
> Sun Microsystems Inc. SunOS 5.7 Generic October 1998
> $ which ps
> /usr/ucb/ps

> 5.7 root->sjrd1# /usr/bin/su - smuser
> Sun Microsystems Inc. SunOS 5.7 Generic October 1998
> $ which ps
> /usr/bin/ps

One part that is important to understanding what is happening here is
that you are including the - option.  Which as the help message stated
implies -l, make the shell a login shell, which means the target
user's .profile et al files are sourced.  My guess is that they are
setting PATH in ways that are unpleasant for you.  Also, the -l login
option initializes path to a compiled in default value.

  info su

The info documentation shows the following.

     Make the shell a login shell.  This means the following.  Unset all
     environment variables except `TERM', `HOME', and `SHELL' (which
     are set as described above), and `USER' and `LOGNAME' (which are
     set, even for the super-user, as described above), and set `PATH'
     to a compiled-in default value.  Change to USER's home directory.
     Prepend `-' to the shell's name, intended to make it read its
     login startup file(s).

Try su without the - option and just switch to the user and then see
if your PATH is changed in any way.  I believe it should not be.
This debatable the best way to use su.

When your su was compiled the autoconf tried to determine if you had
/usr/include/paths.h on your system.  If it did and _PATH_DEFPATH was
defined there then it used that to set DEFAULT_LOGIN_PATH.  If that
was not found then it used a traditional value.  Namely:
# define DEFAULT_LOGIN_PATH ":/usr/ucb:/bin:/usr/bin"
# define DEFAULT_ROOT_LOGIN_PATH "/usr/ucb:/bin:/usr/bin:/etc"

If your system does not have /usr/include/paths.h then you should
patch the source at that point and set the compiled in defaults to be
appropriate for your system.  Or alternatively, and this is what I
would do, install your own /usr/include/paths.h file on your system
and configure it as appropriate for your system.  That way other
software that needs path information and knows about that file will
get your configuration in the future.  I would use an example from
another system and modify it.  That way you will have all of the right
defines in place.

Hope that helps.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]