Ifconfig Broken
I am running centos 4.5
Kernel. 2.6.18 my ifconfig is broken. and i dont know how to fix it. I go into /sbin and i see the file but when i try and execute the command is says bash: ifconfig: command not found. The permissions on the file are as follows -rwxr-xr-x 1 root root 71528 May 25 2008 ifconfig i am still new to Linux and i don't know how to fix this. any suggestions on how to fix it would be great. Thanks. |
# sudo vi /etc/profile.d/env.sh
add strings Code:
PATH=/sbin:/usr/sbin/:$PATH # . /etc/profile # echo $PATH |
Exactly how are you trying to execute "ifconfig"? It's probably a path problem, as "/sbin" isn't really supposed to be in your normal userid's path. Try typing this "sudo /sbin/ifconfig". If you don't have "sudo", then you need to become root and execute "/sbin/ifconfig".
|
It is probably not broken. 'Command Not Found' implies the command is not in your path. It is often not in a regular users path, but will be in the roots path.
To see what your path it set to, in a terminal type 'echo $PATH' without the quotes, just what is between them. As a regular user I get this - Quote:
Here is the path for root on my system - Quote:
Quote:
So you can see ifconfig will be found by root, but not by ther regular user. However, if I want to run it as a regular user, all I need to do is add the path to the command. Like this... Quote:
Hope this helps... |
Thank you all for your quick replys
This is my users $PATH echo $PATH /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/ddennis/bin this is my Root $path /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin if i do a /sbin/ifconfig it does work. so I can tell this is entirely a path issue. As per the first reply i tried to edit the file they listed to add /sbin to the path but the file at the location /etc/profile.d/env.sh does not exist. what file do i need to edit to add the /sbin to my user accounts? |
You should really not add /sbin to your user accounts.
|
Quote:
Code:
PATH="$PATH:/sbin" Code:
# .bashrc |
the reason i am wanting to add it to a specific to user is because I am getting e-mail notification from a cron job that is saying the ifconfig command is not found. the cron job is coming specifically from a file called collectinfo.pl. so i am trying to figure out how to get this to stop because the cron job runs every 5 min. and every time it failes i am getting a e-mail saying that the cron job had errors.
|
Simple, fix the cron job and have it execute "/sbin/ifconfig" rather than just "ifconfig". Generally, any script executing a program should use the whole path, not just the program's name. That should be one of the first thing a script-writer learns.
|
removed. because of double post
|
the cron job is not actually running the ifconfig command it is running a command for a file called collectinfo.pl. I believe that the collectinfo.pl in its processing is running the ifonfig command. and if there is a way to edit that .pl file I would prefer that. but i dont know if that possible.
|
"collectinfo.pl" is a perl file. It can be edited just like any other text file. Give it a shot. Make a backup first, of course.
|
All times are GMT -5. The time now is 03:23 PM. |