LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-15-2003, 12:52 AM   #1
zsutomato
LQ Newbie
 
Registered: Aug 2003
Distribution: SuSe 8.2
Posts: 5

Rep: Reputation: 0
which file control su $PATH?


when I su the root privilege, the $PATH variable changed
which file control this variable, it's different between su $PATH and login root $PATH, I thought they should be the same, but it's not.
excuse for my poor english, here is the example

login:user1
password:
echo &PATH
PATH=/111:/555
su
password:
echo $PATH
PATH=/111:/222
exit
logout

login:root
password:
echo $PATH
PATH=/333:/444

I am sure user1's $PATH is not the same with su $PATH
but why root $PATH is different from su $PATH?

I am using SuSe 8.2 and bash

Last edited by zsutomato; 08-15-2003 at 01:30 AM.
 
Old 08-15-2003, 01:18 AM   #2
contrasutra
Guru
 
Registered: Mar 2003
Location: New Jersey
Distribution: Arch Linux
Posts: 1,445

Rep: Reputation: 46
your universal PATH (the one that all users can use) is located in /etc/profile

that users specific path is located in ~/.bash_profile or ~/.bashrc

~ = The users Home directory.
 
Old 08-15-2003, 01:29 AM   #3
zsutomato
LQ Newbie
 
Registered: Aug 2003
Distribution: SuSe 8.2
Posts: 5

Original Poster
Rep: Reputation: 0
thx for your information, I knew that.
But I want to know why su $PATH and root $PATH is not the same?
it should be the same or not?
If not, why file control su $PATH but not root $PATH?
 
Old 08-15-2003, 01:44 AM   #4
xor3
LQ Newbie
 
Registered: Aug 2003
Location: New Zealand
Distribution: Mandrake Linux 9.1
Posts: 2

Rep: Reputation: 0
.bashrc vs .bash_profile

Quote:
Originally posted by contrasutra
your universal PATH (the one that all users can use) is located in /etc/profile

that users specific path is located in ~/.bash_profile or ~/.bashrc

~ = The users Home directory.
I am looking at both these files to in order to add some things to my path. What is the difference between them? Is it preferable to use one over the other for certain situations?

I was also looking at the universal profile too (I'm adding java to my path if it makes a difference), I'm the only user on my computer, but I may well want root to have access to the same things I do. I was just a bit scared to change the universal profile because what is there already is doing some checking via if statements before adding bits to the path. I don't quite understand yet what is going on well enough to do that kind of checking. I guess it's checking to see if certain files or directories exist before adding them to the path.

Can anyone advise me on the above?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get the absolute path of file using file descriptor. appas Programming 7 01-19-2012 11:47 AM
PATH statement from file granny Linux - Newbie 8 04-21-2005 12:58 PM
Getting file path from FILE pointer in C barisdemiray Programming 3 10-22-2004 12:58 AM
PATH file location corbis_demon Linux - Newbie 1 10-08-2004 05:34 AM
connect file to path gyue Linux - General 2 11-06-2003 06:27 AM


All times are GMT -5. The time now is 08:01 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration