I have such trouble when using ping under root:

ping: icmp open socket: Operation not permitted

What does it mean? When I try ls -l /bin/ping it says:

-rwsr-xr-x 1 root root 30788 Jul 27  2010 /bin/ping

I'm using Debian GNU/Linux 5.0

After few search I found setcap and :

setcap cap_net_raw=ep $(which ping)
  • I had that problem with the default installation of SparkyLinux (facepalm). Zulu's solution fixed it. – msb Aug 10 '14 at 2:00
  • I had this with a Debian chroot inside an Ubuntu 14.04, and executing this to the debian executable while not chroot'ed fixed it. – Vargas Nov 3 '15 at 14:19
  • This fixed the problem on Raspbian 8. – user46935 Jan 1 '16 at 16:34

You might have an iptables rule preventing pings from getting to localhost (this is entirely possible with iptables).

The following will clear all iptables rules. Do this cautiously because iptables is used to implement firewalling on Linux, so you are effectively disabling your firewall.

iptables -P INPUT ACCEPT
iptables -F
iptables -X

This could happen if your route table is messed up, I believe, as well. Give us the output of route if the above leads nowhere.

The only other thing I can think of is that you have lo, the localhost "virtual network adapter", involved in some weird bridging configuration with another adapter. But this is highly unlikely (but you can use brctl to check).

  • I have real IP that's why I don't want to open totally computer to world in case of clearing iptables. ifconfig says besides lo: lo:4 Link encap:Local Loopback inet addr:92.xxx.xxx.xxx Mask: UP LOOPBACK RUNNING MTU:16436 Metric:1. brctl not found. – Massimo May 25 '11 at 18:41
  • # iptables --list FATAL: Could not load /lib/modules/2.6.34-vs2. No such file or directory iptables v1.4.2: can't initialize iptables table filter': Permission denied (you must be root) – Massimo May 25 '11 at 18:44

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.