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

Re: Debian's root path



On Tue, Jul 23, 2002 at 16:30:38 -0500, Ron Johnson wrote:
> On Tue, 2002-07-23 at 16:12, Mark Roach wrote:
> > On Mon, 2002-07-22 at 17:23, Ron Johnson wrote:
> > > On Mon, 2002-07-22 at 02:52, Osamu Aoki wrote:
> > > > On Mon, Jul 22, 2002 at 02:49:58AM -0400, ThanhVu Nguyen wrote:
> > > > > How did Debian setup so when I su (just su, not su -) to root ,
> > > > > immediately I can access all the root's only program (but not when I
> > > > > am just a normal user)?  I found this very convenient and want to do
> > > > > it on my other Linux distrib.
> > > > Set up login shell.  So for bash, ~/.bash_profile (or ~/.profile)
> > > 
> > > Can you please expound upon that rather terse reply?
> > 
> > basically, create a file named /root/.profile and in it put
> > root-specific stuff such as
> > 
> > PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
> > export PATH
> > 
> > for some reason I thought this happened automatically in Debian.
> 
> Here's a snippet from my Debian-created .bash_profile :
> 
> # set PATH so it includes user's private bin if it exists
> #if [ -d ~/bin ] ; then
> #    PATH=~/bin:"${PATH}"
> #f
>
Hmmm, I can't seem to see where root's path is set.  Take a look at the
following:
For my user:
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:~/bin

Then when doing su -
$ su -
Password:
# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
# exit
logout

Then when doing su
$ su
Password:
# echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/bin/X11:/usr/local/sbin:/usr/local/bin

??? Where is this path set?  It has been changed from my users value. ???

The problem is that I can't see where the path is set when doing just
su.

In /root/ there is the .profile file which is executed when doing
su -, and it contains the line:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
Which explains how the path is set when doing su -.  But this file is
not executed when doing plain su. (I think).  In any case the paths
above are different, so it is changed somewhere else when doing plain
su.

So the question still is, where is the path changed when doing plain su?

I do not have a .bash_profile file in /root/ and .bashrc contains no
mention of $PATH.  The only other system-wide setting I can find is:
/etc/profile which contains the line:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11"
which is not the same as what I get when doing su.
I do not have either of: /etc/bashrc, or /etc/bash_profile.

So where is the $PATH changed when doing plain su (without the hyphen)?

Cheers.
Mark.

Attachment: pgpsGjsHssuXO.pgp
Description: PGP signature


Reply to: