简介:
ping: icmp open socket: Operation not permitted 的解决办法


为 ping 加上 suid 即可。

yyc@localhost ~ $ sudo route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.190.40.0 * 255.255.254.0 U 2 0 0 eth0
loopback localhost 255.0.0.0 UG 0 0 0 lo
default 10.190.40.1 0.0.0.0 UG 2 0 0 eth0

yyc@localhost ~ $ ping 10.190.40.1
ping: icmp open socket: Operation not permitted

yyc@localhost ~ $ ls -l /bin/ping
-rwxrwxrwx 1 root root 34628 9月 2 12:15 /bin/ping

yyc@localhost ~ $ sudo chmod u+s /bin/ping

yyc@localhost ~ $ ls -l /bin/ping
-rwsrwxrwx 1 root root 34628 9月 2 12:15 /bin/ping

yyc@localhost ~ $ ping 10.190.40.1
PING 10.190.40.1 (10.190.40.1) 56(84) bytes of data.
64 bytes from 10.190.40.1: icmp_req=1 ttl=255 time=0.871 ms
64 bytes from 10.190.40.1: icmp_req=2 ttl=255 time=0.865 ms
^C
--- 10.190.40.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.865/0.868/0.871/0.003 ms



Author:yangyingchao, 2010-11-03