LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   PATH changes for no reason? (https://www.linuxquestions.org/questions/linux-software-2/path-changes-for-no-reason-102807/)

shanenin 10-11-2003 12:38 PM

PATH changes for no reason?
 
I just installed slackware 9.1 . First I want to say it was surprisenly easy. I got my X working in a day. I have just been using redhat 2 months prior. I would recommend this distro to any new linux users who want to learn.

Here is my problem. If a change from su to regular user in the terminal my path changes. Or if I change from regular used to su my path changes. The only way I can get my full path to come back is to start an other terminal session.

below is a is an example.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
shane@marsala:~$ $PATH
-bash: /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin :/usr/lib/java/bin:/usr/lib/java/jre/bin:/opt/kde/bin:/usr/lib/qt-3.2.1/bin:/usr /share/texmf/bin:.: No such file or directory
shane@marsala:~$ su
Password:
root@marsala:/home/shane# $PATH
bash: /usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin: No such file or directory
root@marsala:/home/shane# su shane
shane@marsala:~$ $PATH
bash: /usr/local/bin:/bin:/usr/bin: No such file or directory
shane@marsala:~$
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

This happens the reverse way also if I start as root and change to user

jailbait 10-11-2003 02:04 PM

"If a change from su to regular user in the terminal my path changes. Or if I change from regular used to su my path changes. The only way I can get my full path to come back is to start an other terminal session."

It is normal for root, su, and user to have different PATHs. You can change the PATH for user and root in .profile or .bashrc. I have never bothered to find where PATH is set for su. If you find out let me know.

To add directories to the path add the following command to /home/user/.bashrc

export PATH=$PATH:/my/extra/command/directory

___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites

shanenin 10-11-2003 02:37 PM

I know the path is different between user and root. My root path is changeing. take a look at my example above.

jailbait 10-11-2003 02:53 PM

This is normal. su root does not necessarily get the same PATH as root. su shane does not necessarily get the same PATH as shane. All of this is configurable somewhere but I have never bothered to look up how to configure it.

If you want to go from shane to root to shane try:
su
password
.
.
.
.

exit



___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites


All times are GMT -5. The time now is 11:38 PM.