keep change in PATH
I've found it necessary to export /usr/sbin to my shell using the command 'export path=$PATH:/usr/sbin'. It works for a day or so then i have to give the command again....why? how to fix:o
|
"I've found it necessary to export /usr/sbin to my shell using the command 'export path=$PATH:/usr/sbin'. It works for a day or so then i have to give the command again....why? how to fix"
Whenever you logout or reboot the PATH variable is set back to the original value. You can make your export command permanent by placing it in /home/user/.bashrc on most distributions. ---------------------- Steve Stites |
That's the way you do it, but why do you need to put /usr/sbin in your PATH? The way I understand it, that's usually just for programs that normally need root permissions, and root's PATH should include it.
|
Quote:
Thanks |
jrdioko,
performing routine sys admin, i find i need it to run things like ifconfig, ... I found that without this addition I cant run these pgms... |
/root
|
# .bashrc
# User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi would i add it where i did below? # .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc, /usr/sbin fi thanks again |
Add it wherever you want, just stick it on the top or bottom. I'm pretty surprised that /usr/sbin isn't in root's PATH, though. How are you becoming root? Try going to a console, typing "su -" to become root (the "-" is required to inherit all the things in root's .bashrc), and seeing what "echo $PATH" gives you.
|
Here is the display
[root@localhost root]# echo $PATH /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin and i added here: # .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc,/usr/sbin fi I hope a comma separated list is the correct syntax. |
Well ok, not anywhere. That section is for something entirely different. Pick a new line, outside of any existing section, and put:
Code:
export PATH=$PATH:/usr/sbin |
jrdioko,
i added the line after the fi. It shows in the path now b/c I haven't rebooted, but, rest assured, when i do it will be gone. I can check it tomorrow, for, when i reboot i have to manually load the driver fot eth0 by typing: /sbin/insmod e100 where e100 is the name of the driver. I'd like to get this to run automatically as well. Any ideas? |
Unless you have a reason not to, you probably want to use modprobe instead of insmod to load modules. On my system, those lines go in /etc/rc.d/rc.modules.
Are you using "su -" instead of "su" to become root and /usr/sbin still isn't showing up in your path? |
All times are GMT -5. The time now is 06:52 AM. |