LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-30-2002, 12:05 AM   #1
NewRedHatter
LQ Newbie
 
Registered: Aug 2002
Posts: 10

Rep: Reputation: 0
RedHat 7.3 PATH env variable problem


I have a newly installed version of RedHat 7.3 running on my laptop (installed from FAT32 volume).

My rc.sysinit shows these lines at the beginning of the file.

PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH

However, by the time I have logged into the system and gotten into KDE, my PATH is now:

PATH=/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/home/user/bin

What are all of the possible config files where this is being changed?

More importantly, you can see that /sbin and /usr/sbin get clobbered in the init process, where is the best place to fix this??? (And how/where is this happening?)

Thx...
 
Old 08-30-2002, 01:53 AM   #2
dwd
Member
 
Registered: Aug 2002
Distribution: RedHat / Debian / Ubuntu
Posts: 35

Rep: Reputation: 15
Yes... You're not loggin in as root, there, so you shouldn't get the sbin paths anyway. Non-root users can often run some sbin things, but normally wouldn't want to anyway.

Switching to root with "su -" should give you the paths back, as well as becoming root, which is, after all, the time when you probably want to run the sbin programs.

In an interactive shell, you'll be running .bash_profile, and in a non-interactive shell, you'll run .bashrc. On RedHat, it makes little difference, but .bashrc will add the ~/bin directory to the path, for user's personal scripts.

They'll also call /etc/bashrc, which sets paths too, but generally by way of the scriptlets in /etc/profile.d/

You'll be glad to know that no paths are getting clobbered, though - the path you've quoted is the right one for a user called "user".
 
Old 08-30-2002, 11:04 AM   #3
NewRedHatter
LQ Newbie
 
Registered: Aug 2002
Posts: 10

Original Poster
Rep: Reputation: 0
Followup...

That's the problem though. If I do an su in a Konsole or relogin as root (through KDE) I get the same PATH structure, i.e. no /sbin paths.
 
Old 08-30-2002, 11:07 AM   #4
NewRedHatter
LQ Newbie
 
Registered: Aug 2002
Posts: 10

Original Poster
Rep: Reputation: 0
Got it... I did an "su -" with the minus sign and it gives me my PATHs back...

I'll have to dig around a little in those scripts and see where the PATH is getting changed (just out of curiousity).

Thx for the help...
 
Old 09-01-2002, 05:14 AM   #5
dwd
Member
 
Registered: Aug 2002
Distribution: RedHat / Debian / Ubuntu
Posts: 35

Rep: Reputation: 15
No, your paths are *not* being changed. They're being setup perfectly.

Root's path is different from an ordinary user's because only the root user should be running programs within /sbin and /usr/sbin (and /usr/local/sbin).

Most of the programs won't work as anything other than root anyway. Others may work, but will not do anything useful - for instance, mke2fs won't do anything useful because your ordinary users don't have write access to block devices.

All this is a "good" thing.

The reason that "su" doesn't work, whereas "su -" does, is because "su -" sets up the environment for the user (in this case, root) whereas "su" doesn't.
 
  


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
env variable for proxy: syntax FrayAdjacent Linux - Networking 10 07-13-2005 05:44 PM
env variable allelopath Linux - Software 3 04-14-2005 12:07 PM
unsetting a part of ENV variable praveenv Linux - Newbie 3 08-28-2004 09:36 AM
Environment Variable: how to change env DISPLAY in Redhat 9 lucastic Linux - General 2 07-21-2004 04:15 PM
Changing $PATH env variable alzogbi Linux - Newbie 2 03-26-2004 02:06 AM


All times are GMT -5. The time now is 01:31 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