LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 04-25-2004, 12:57 PM   #1
weghman
LQ Newbie
 
Registered: Apr 2004
Location: Denver, Colorado, USA
Distribution: fedora core 2
Posts: 2

Rep: Reputation: 0
As root, not seeing /sbin and /usr/sbin in path


Hello Everyone,

I am running Fedora Core 2. I do not have /sbin and /usr/sbin in my path when I switch to root and type echo $PATH.

Below is my /etc/profile file. It seems to me that although I have added additional paths to my PATH variable, the sbin paths should still show up in $PATH. What am I doing wrong?

Thanks - Dan


# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|$1($|" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}

# Path manipulation
if [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi

pathmunge /usr/X11R6/bin after

unset pathmunge

# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"

HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi

WAS_HOME='/opt/WebSphere/AppServer'
CATALINA_HOME='/opt/tomcat'
IBMIHS_HOME='/opt/IBMIHS'
ANT_HOME='/usr/local/apache-ant-1.6.1'
PATH=$PATH:./:/usr/local/Acrobat5/bin:/usr/local/apache-ant-1.6.1/bin

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC WAS_HOME CATALINA_HOME IBMIHS_HOME ANT_HOME


for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done

unset i
 
Old 04-25-2004, 01:03 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Hmmm, seems to me that .bash_profile only gets read when you initially log in at the console, not when you SU to root.

I would put:
"export PATH=$PATH:/sbin:/usr/sbin"
into root's .bashrc file (which gets read when you SU...)
 
Old 04-25-2004, 01:03 PM   #3
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
When you switch to root - do you use "su"? Try "su -".
 
Old 04-25-2004, 01:06 PM   #4
weghman
LQ Newbie
 
Registered: Apr 2004
Location: Denver, Colorado, USA
Distribution: fedora core 2
Posts: 2

Original Poster
Rep: Reputation: 0
Ah - yes! You are both right. I need to switch to root using su -

Thank you so much for your quick replies.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
/sbin/rc: line 271: /sbin/devfsd: No such file or directory Alexander.s Linux - General 3 04-22-2005 04:44 PM
Want2use /sbin cmds undr non-root account w/o sudo. Is it safe 2 add /sbin 2 my PATH? kornerr Linux - General 4 02-25-2005 09:29 AM
$PATH for root to /sbin mickeyboa Fedora 6 01-15-2005 11:07 AM
/usr/sbin and /sbin world read/executable... why? lazlow69 Slackware 3 04-29-2004 05:06 PM
/sbin vs /usr/sbin !?!?!? different? sirpelidor Red Hat 1 10-24-2003 03:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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