Linux – Why the same user has different PATH value on linux server

environment-variableslinuxsu

I logged on to my Linux server (Redhat AS4) through SSH as the user 'guest', then run the command echo $PATH, and the output is /usr/local/bin:/bin:/usr/bin.

However, when I run the command su - guest to switch to the same user, then run the command echo $PATH, the output becomes /usr/bin:/bin:/usr/local/bin.

Why the same user has different PATH value on Linux server? That makes me get different Python versions and I don't know what causes this problem.

Best Answer

Try to debug using the technique described in my answer on superuser, using

debug_msg "running ~/.bashrc ($0), PATH = '$PATH'"

and similar for /etc/bashrc, /etc/profile, etc.