LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to ensure paths are set during boot (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-ensure-paths-are-set-during-boot-545919/)

greengrocer 04-13-2007 09:37 PM

How to ensure paths are set during boot
 
Hello all,

Using Fedora Core 6 at present, but I suppose the answer to this question will apply to many distros.

How does one configure 'paths' so that the desired 'paths' are configured during the boot process?

For instance, when I am root, I always have to type '/sbin/ifconfig' which is annoying. I would like to just type 'ifconfig'

So how do I set /sbin as a default 'path' for linux to look into for the commands I type, during boot up?

Regards,
greenie

greengrocer 04-13-2007 10:19 PM

I edited /etc/profile and added "pathmunge /sbin", so the end of the /etc/profile file looks like this:

Code:

done
 pathmunge /sbin
unset i
unset pathmunge

It solved my immediate frustration, but I am wondering if this is good practice?

Regards,
Greenie

AwesomeMachine 04-13-2007 11:41 PM

With a few exceptions all the commands in /sbin must be run as root. Ifconfig happens to have one function that can be run as user: Ifconfig with no parameters gives interface info. If there is a program you want to run as user, but it isn't in the user's PATH you do this:


#!/bin/bash
#ifconfig file for normal users
/sbin/ifconfig
end

in a text editor. Make it exectutable:

chmod a+x <filenameofscript>

and then, from whatever directory the file is in:

./filenameofscript

will run /sbin/ifconfig.

Electro 04-14-2007 12:47 AM

The easiest is to add the following line to /root/.bashrc or /root/.profile.

PATH=$PATH:/sbin

If you use su - to substitute user for root, then you will not be in this problem. Both Redhat and Fedora have the same issue.


All times are GMT -5. The time now is 02:09 PM.