Skip to contentSkip to conversation

Setcap #yocto

DISCUSSION Luigi Scagnet 1 participant 1 message Sep 2, 2020

lore
Share & tools
lore
#0 lore raw

Hi everybody,

I've builded a rootFS for my custom board based on i.Mx6UL and Yocto Zeus and Linux 4.14 imx, when i try the ping command with non root user I have the follow problem:

admin@797c:~$ ping -c2 8.8.8.8
ping: socket: Address family not supported by protocol

if I try with root user:

root@797c:~$  ping -c2 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=115 time=23.7 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=115 time=23.1 ms

Looking at some online docs seems a problem of "file capabilities" then I've tried this:

root@797c:~$ setcap cap_net_raw+ep /bin/ping.iputils
admin@797c:~$ ping -c2 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=115 time=23.6 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=115 time=23.1 ms

How I can do the setcap command during the build process? I need to have a rootfs.tar.gz ready to use.

Thanks in advance