LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-25-2007, 10:30 PM   #1
c4nk
Member
 
Registered: Oct 2006
Distribution: CentOS 4 :) and Win Xp ;(
Posts: 32

Rep: Reputation: 15
ifconfig not working


when i type in ifconfig in terminal it says "bash: ifconfig:command not found" i also tried loging in as root with same message, any suggestions.
 
Old 01-25-2007, 10:40 PM   #2
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 76
It's usually in /sbin, which might not be in your path.

When all else fails...
Code:
# find / -name "ifconfig"
 
Old 01-25-2007, 10:54 PM   #3
c4nk
Member
 
Registered: Oct 2006
Distribution: CentOS 4 :) and Win Xp ;(
Posts: 32

Original Poster
Rep: Reputation: 15
It is displayed in /sbin alright, but it doesnt want to run even though am in that directory. this has never happened to me that a command didn't want to run
 
Old 01-25-2007, 11:21 PM   #4
Dan04
Member
 
Registered: Jun 2006
Location: Texas
Distribution: Ubuntu
Posts: 207

Rep: Reputation: 37
Did you try explicitly typing /sbin/ifconfig?
 
Old 01-25-2007, 11:32 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
A normal user most likely should be able to run "/sbin/ifconfig". Look at the permissions: "ls -l /sbin/ifconfig".
However a security setting may disallow it. The command will only allow reading information if a normal user runs it. For example, to check what your devices IP address is.
Code:
-rwxr-xr-x 1 root root 65832 2006-11-25 17:13 /sbin/ifconfig
To change device setting with the command you need to run "sudo /sbin/ifconfig". Here you probably have to include the full path. This is a security safeguard to prevent a hacker from placing a program by the same name in your path. Or to prevent sudoers from executing a different ifconfig program which might give them full root access.

Also check the logs to see if the selinux configuration prevents this command from being run or executed by a normal user. Again, this may be an indirect setting due to a generic security level policy. ( For example, maybe you have restricted access to /proc to prevent abuse by a normal user on the machine. It is possible that such a policy could end up restricting the use of /sbin/ifconfig. I doubth this, however. Blocking access to /proc would disable /sbin/ifconfig so restricting its use would be redundant.

It might be a good habit to include the full path names for commands in /sbin/ and /usr/sbin/, rather than adding these paths to $PATH. Normally when you use them you will be using "sudo" to perform the command as root and will need to anyway.
 
Old 01-26-2007, 02:19 AM   #6
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 76
You cannot execute a command from your cwd unless "." is in your $PATH. To run a command in cwd you need to prefix it with "./", such as ./ifconfig .
 
  


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
ifconfig command not working! WorldBuilder Linux - Networking 9 08-06-2006 11:15 AM
redhat 4.0, ifconfig eth? down not working randyding Linux - Hardware 1 05-29-2006 01:50 AM
connecting /sbin/ifconfig to bash command ifconfig flammable2 Fedora 4 11-12-2005 07:58 AM
eth0 not showing in ifconfig, dhcp not working dolem98 Linux - Networking 3 12-07-2004 04:42 PM
iwconfig and ifconfig not working t3kops Fedora 1 07-17-2004 01:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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