# [Solved] Weird problem with ping

## The Main Man

Never had this before, I have no idea where the problem is.

Ping as a user gives this :

```
$ ping www.google.com                                                                                                                                                                                                       

ping: socket: Address family not supported by protocol
```

while as root it works

```
# ping www.google.com                                                                                                                                                                                                  

PING www.google.com (172.217.17.164) 56(84) bytes of data.

64 bytes from sof02s21-in-f164.1e100.net (172.217.17.164): icmp_seq=1 ttl=56 time=19.4 ms

...
```

What could be causing this ?Last edited by The Main Man on Sat Feb 09, 2019 10:02 pm; edited 1 time in total

----------

## mike155

 *Quote:*   

> What could be causing this ?

 

Wrong mode bits of /bin/ping, especially a missing 'S_ISUID' bit.

The output of 'ls -la /bin/ping' should be:

```
-rws--x--x 1 root root 56704 Jan  2 00:38 /bin/ping
```

----------

## The Main Man

 *mike155 wrote:*   

>  *Quote:*   What could be causing this ? 
> 
> Wrong mode bits of /bin/ping, especially a missing 'S_ISUID' bit.
> 
> The output of 'ls -la /bin/ping' should be:
> ...

 

Right, but how that happened ?

I even re-emerged iputils.

----------

## mike155

Maybe a nosuid flag in the mount options of a filesystem?

Or FEATURES="suidctl" in /etc/portage/make.conf?

----------

## The Main Man

No, I did try to use Non Root Xorg, but that failed, all I did was -suid in xorg-server but I reverted that back to suid.

But I forgot about that before I posted this, it's probably related, can't think of anything else.

I solved ping permissions but wonder what else is there...

----------

## mike155

It's strange that 'emerge iputils' didn't fix the 's' mode bit for you.

On my machine, 'emerge iputils' fixes wrong mode bits:

```
# chmod oug-s /bin/ping                                # remove s mode bit

# ls -la /bin/ping

-rwx--x--x 1 root root 60896 Feb  9 22:35 /bin/ping    # s bit is missing

# emerge iputils

<some output>

# ls -la /bin/ping

-rws--x--x 1 root root 60896 Feb  9 22:37 /bin/ping    # s bit was fixed

```

----------

## The Main Man

It was one step from Non Root Xorg Wiki :

```
Create udev rule to change /dev/input group on boot: 

SUBSYSTEM=="input", ACTION=="add", GROUP="input"

/etc/init.d/udev reload
```

Once I reverted that all is good, 'emerge iputils' now sets it as it should.

Thanks mike155!   :Very Happy: 

----------

## Ant P.

 *mike155 wrote:*   

>  *Quote:*   What could be causing this ? 
> 
> Wrong mode bits of /bin/ping, especially a missing 'S_ISUID' bit.
> 
> The output of 'ls -la /bin/ping' should be:
> ...

 

The output of 'ls -la /bin/ping' should really be:

```
-rwx--x--x 1 root root 55992 Jul 21  2018 /bin/ping
```

And the output of 'getcap /bin/ping' should be:

```
/bin/ping = cap_net_raw+ep
```

Don't needlessly give things suid root perms. USE=filecaps is on by default for a reason.

----------

## mike155

Ant P: you're right! Thanks for pointing that out! I should have considered that many (most?) Gentoo systems use capabilities and extended attributes. On those machines, setting the S_ISUID mode bit is wrong. 

Note: I don't use capabilities or extended attributes. Consequently, setting the S_ISUID mode bit for /bin/ping is the right thing to do on my machines.

----------

