LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   commands are dissapearing on me! (https://www.linuxquestions.org/questions/linux-newbie-8/commands-are-dissapearing-on-me-71002/)

digsby0007 07-08-2003 12:12 PM

commands are dissapearing on me!
 
if i su to root, there are certain commands i cannot run.
lets say i type ifconfig as root, it tells me there is no command not found. Im running red hat 8, and im in a bash prompt, so how can i assosiate the command "ifconfig" to the actual location of the program in /sbin


thanks,
digsby

MasterC 07-08-2003 12:16 PM

When you change users, specifically when you change users to the superuser (aka root) your $PATH variable gets reset. If you look in /etc/profile****(see below) you should see pretty much exactly what happens. In that same file, if you edit the $PATH that is set for root once you have su'd to have /sbin in it, then logout and backin as root, the change should take effect immediately.

So the entry might look like this:
Code:

# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH.  Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
  echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
  if [ ! $? = 0 ]; then
    PATH=/usr/local/sbin:/usr/local/mysql/bin:/usr/sbin:/sbin:$PATH
  fi
fi

After you've added the /sbin to the PATH variable (located at the bottom of the code above).

HTH

Cool

***: /etc/profile is very important in getting the system running, and keeping it running correctly. Be very careful when you edit this file, and always make a backup of a working copy before making changes.


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