ifconfig

10 respuestas [Último envío]
lammi87

I am a member!

Desconectado/a
se unió: 07/27/2012

I just tried to run ifconfig in 5.5.

$ ifcongig

Got an error: command not found. I then tried:

$ /sbin/ifconfig

Worked just fine. I thought that ifconfig was a basic
command to use. Why is it not included to the $PATH ?

jxself
Desconectado/a
se unió: 09/13/2010

It didn't work because the command contains a typo. Notice the command was ifcongig (notice it has a "g" instead of an "f")

lembas
Desconectado/a
se unió: 05/13/2010

Probably has to do with how the users and the admins used to be separate in the days of mainframes. A PC is a relatively new phenomenon.

/sbin is for system binaries, it is in the root path. http://en.wikipedia.org/wiki/Unix_directory_structure

lammi87

I am a member!

Desconectado/a
se unió: 07/27/2012

Sorry about the typo. My bad. But I really tried to run just

ifconfig

and it did not work. It really seems to be in the root path.

sudo ifconfig

and

# ifconfig

run just fine. Thanks for the help.

lammi87

I am a member!

Desconectado/a
se unió: 07/27/2012

Wait a minute...

Why can a regular user access ifconfig with

/sbin/ifconfig

If it is supposed to be only used by root?

Magic Banana

I am a member!

Desconectado/a
se unió: 07/24/2010

She can execute '/sbin/ifconfig'. Only 'ifconfig' will not run because "/sbin" is not in her PATH variable (Bash does not find the binary; nothing to do with permisions). She can add the this directory to PATH though. For instance, she can edit ~/.bashrc and add, at the end of that file:
PATH="/sbin:$PATH"

Then 'ifconfig' will run.

lammi87

I am a member!

Desconectado/a
se unió: 07/27/2012

I understand that but if ifconfig is supposed to be run by root only then why can a regular user access it? Why is it not protected with permissions? Is it supposed to be run by root only?

Michał Masłowski

I am a member!

I am a translator!

Desconectado/a
se unió: 05/15/2010

Try running e.g. "ifconfig eth0 192.168.3.2" as a non-root user, it will
fail with some operation not permitted errors. It's ok for most users
to read the data that ifconfig shows (and they can obtain it in other
ways), although it's not useful enough for it to be needed on $PATH.

Magic Banana

I am a member!

Desconectado/a
se unió: 07/24/2010

The default behavior of 'ifconfig' (i.e., when called without any argument) is to display the configuration of the network interfaces. Any user is allowed to read that information. 'ifconfig' allows to configure those interfaces too. This time administrator's privileges are required. Maybe 'ifconfig' would be better placed in /bin... or not. :-)

lammi87

I am a member!

Desconectado/a
se unió: 07/27/2012

Ok this clears thins up. Thanks everyone for your answers.

MagicFab
Desconectado/a
se unió: 12/13/2010

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 13-01-16 03:40 AM, name at domain wrote:
> Ok this clears thins up. Thanks everyone for your answers.

IIRC we shoul dnot be using ifconfig anymore:
https://dougvitale.wordpress.com/2011/12/21/deprecated-linux-networking-commands-and-their-replacements/

F.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: PGP/Mime available upon request
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlD2o+UACgkQfUcTXFrypNXw+QCfXLO+kEVzB4Tke+U27eVlAhS5
C/oAn0W/fPgr39oDKvGjhaRBd28i7wSb
=lnHW
-----END PGP SIGNATURE-----