LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-01-2001, 04:53 AM   #1
eddielins
LQ Newbie
 
Registered: Apr 2001
Location: Brisbane, Australia
Posts: 5

Rep: Reputation: 0
Unhappy



I set a PATH as follows:
# PATH=/sbin:/usr/sbin:$PATH
# export PATH

After I set this PATH, I only can use it if I don't logout
or reboot. How can I keep it permanently without doing it
again and again? (I did click "Save Current setting" before
I logout.) The same thing happens when I configure my NIC
as well...... How can I solve these problems???
Thx


 
Old 04-01-2001, 05:26 AM   #2
elad
LQ Newbie
 
Registered: Mar 2001
Location: israel
Posts: 21

Rep: Reputation: 15
Exclamation not sure about this

if i'm not mistaken there are a few files that are read each time you log in.
.profile in your home dir
/etc/.profile
.bashrc in your home dir

you should save the files in another name and then put that line with path=etc...
this should make the changes permanent.
if it doesn't work don't forget to put back the old file so that you won't have any problems.
i think it's best to try them one at a time.
 
Old 04-01-2001, 09:07 AM   #3
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
System-wide config for bash goes into the file /etc/profile.
And if you would like to add this extra path info for a single user, then add it to the hidden file .bah_profile
 
Old 04-01-2001, 10:43 AM   #4
eddielins
LQ Newbie
 
Registered: Apr 2001
Location: Brisbane, Australia
Posts: 5

Original Poster
Rep: Reputation: 0
Angry


when I check the hidden file /root/.bash_profile, I saw
PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH:$HOME/bin
(I didn't add anything yet!)
Is that mean I can use any command under those directory?
But when I typed some commands such as route, the message
still show up: "command not find". If I have to add those
path in /root/.bash_profile, how should I type it?
And if I add this path in /etc/profile, is that mean
everyone who logon can use it without adding it?
thx again
 
Old 04-01-2001, 11:23 AM   #5
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602

Rep: Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084
/etc/profile is a system wide config file that affects all users. When you login do you always do it as root? If you do you should really create a non-privilaged user and login with that.
 
Old 04-01-2001, 11:48 PM   #6
eddielins
LQ Newbie
 
Registered: Apr 2001
Location: Brisbane, Australia
Posts: 5

Original Poster
Rep: Reputation: 0
This time I login as another user that I created and it's
working(I can use those commands...). However, if I use su instead of su - to change into superuser, I still can't use those commands, why? What's the difference between them?

Also, I add a path :/sbin:/usr/sbin follow by the PATH in .bash_profile under another user's home directory.
And then I login as that user and tried to use commands
such as route, but it's still no working. I think I am
quite confused about this...
Thx
 
Old 04-02-2001, 08:18 AM   #7
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
Let's say your new user name is steve. When steve login and system starts a bash shell (assuming you use bash for your shell) it reads the /home/steve/.bash_profile
When you su to root access then a new bash shell isn't started so therefore the files in /root isn't run. Thus the path isn't modified.

Also some commands aren't ment to be run as non-privilaged users. Route is one of them, this is for safety and to prevent accidental use of them.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PATH question satimis Linux From Scratch 5 09-15-2005 10:23 AM
Another $PATH question iamnilo Fedora 2 09-13-2004 03:02 PM
question about $PATH drewski Linux - General 2 01-06-2004 02:17 AM
question about $PATH SigningiS Linux - Newbie 17 10-27-2003 12:35 PM
Question on path PatC Linux - General 1 07-09-2002 09:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:28 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration