Richard You are definetly not being thick but would be interested in which flavour of unix you are running. Under Solaris if a plain 'su' is used all environment variables are passed EXCEPT PATH, which is set by the shell script /etc/default/su. I haven't generally seen this setup used in linux, but perfectly possible, so a bit of hunting required I'm afraid. Peter. On Thu, 2003-07-24 at 19:43, richard@tortoise.demon.co.uk wrote:
Hi Thomas,
could you bear with me on this?
I don't think /etc/profile is executed if I su to root. If I put something like echo "here we are in /etc/profile" at the start of it, I never see the echo when I su
Of course not. I am taking that last sentence literally when you say "su" and not "su -". If you just "su", then yes, you will get to be user "root", but all that has done is to change your effective $UID and $GID. NO environment variables are modified with a plain "su".
Ok, so no environment variables are modified. $PATH is an environmental variable.
richard@linux:~ > echo $PATH /usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/lib/java/bin:/var/lib /dosemu:/usr/games/bin:/usr/games:/opt/gnome/bin:/opt/kde2/bin:/opt/kd e/bin:/usr/openwin/bin:.:/opt/gnome/bin:/opt/pilotsdk/bin richard@linux:~ > su Password: root@linux:/home/richard > echo $PATH /usr/sbin:/bin:/usr/bin:/sbin:/usr/X11R6/bin
So a plain su HAS modified an environmental variable. PATH wasn't constructed after su within /etc/profile because /etc/profile wasn't run.
So the question remains, where does the new path come from?
I'm likely being thick here.
regards Richard
-- richard@tortoise.demon.co.uk