Home | News | Download | Packages | Forum | Wiki | Github

Ping requires sudo


#1

I have to use sudo to run ping, otherwise I get ping: icmp open socket: Permission denied. Anyone know how to fix this? I tried adding my user to the groups network, dialout, sys, wheel and adm, but it didn’t help.


(Masato the Empty) #2

It sounds like the capabilities on iputils-ping could be messed up. Ping has always needed special permissions or attributes set to be usable by nonroot, and iputils uses capabilities. So you should check them (the proper ones seem to be cap_net_raw+ep)
# getcap /usr/bin/iputils-ping /usr/bin/iputils-ping = cap_net_raw+ep
That should also be the output for iputils-ping6…

If it’s not, then you should try to set them:
(as root/sudo/doas)
# setcap cap_net_raw+ep /usr/bin/iputils-ping


#3

getcap /usr/bin/iputils-ping gave empty output.

That fixed it. Thanks! :smiley: