I want to run an ICMP command to ping an IP Adress at Java:
InetAddress.getByAddress("XXX.XXX.XXX.XXX".getBytes()).isReachable(1000);
However there is a security restriction that:
Normal users are allowed to create raw sockets.
So I can not run it. I don't want to run my application as root. So, which privileges should I assign to the user that runs my application for CAP_NET_RAW capability?
java
) itself, and there are some major PITA issues that come along with that if you are using, e.g., an Oracle install with libs outside of standard places like/usr/lib
. See here: http://unix.stackexchange.com/questions/87978/how-to-get-oracle-java-7-to-work-with-setcap-cap-net-bind-serviceep – goldilocks Nov 20 '14 at 13:24