Can I use libpcap without root privileges?
Posted on 2009-02-19
We have created an application which sniffs packets from the network. It runs through Java Web Start and uses libjpcap which in turn uses libpcap. This application is being run on Ubuntu 8.10.
The challenge is, when we run the application using root privileges (such as by using sudo), then it works fine and lists the network cards also. However, when we use it as an unprivileged user, then it doesn't display network card information and thus does no sniffing as well.
Wireshark also behaves in the same manner and and it is specifically mentioned in Wireshark's documentation to sniff the packets through root only. However, it would not be possible to make all users run as root in our environment.
Is there any way we can use non-root privileges to do sniffing? Maybe through
* allowing full network card access to a group?
* any other packet capturing library which allows this? We need to use it through java only.
We did "ifconfig eth0 promisc" but it doesn't help.