Why do i have to be root to run the command ifconfig?

6,871

As the message says, the problem is that ifconfig is not in your path. You can run it as a normal user by giving the full path: /sbin/ifconfig. Try it!

My guess is that on 10.04 you added /sbin/ to your path, and didn't do that when upgrading to 12.04.

Note, however, that you will need to be root if you want to use ifconfig to change networking configurations; I hope the reasons for this are more than obvious :)

Share:
6,871

Related videos on Youtube

Mads
Author by

Mads

Updated on September 18, 2022

Comments

  • Mads
    Mads over 1 year

    I've recently switched from Ubuntu 10.04 LTS to 12.04 LTS, and one of the changes i have noticed is that when i try to run the command ifconfig (for example to view my own ip), i get the following output:

    Command 'ifconfig' is available in '/sbin/ifconfig' The command could not be located because '/sbin' is not included in the PATH environment >variable. This is most likely caused by the lack of administrative privileges associated with your >user account. ifconfig: command not found

    In order to run the command, i have to run sudo ifconfig. This was not the case in 10.04, so i wonder: is there a reason for this change? Is this the expected behavior for 12.04, or is something wrong with my settings? Hopefully someone else running Ubuntu 12.04 can try running the command and see if they get the same result as me.

    • Sparhawk
      Sparhawk over 10 years
      The two existing answers don't really solve the problem in the long term. You need to make sure your $PATH is correct. Please post the output of echo $PATH.