Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

60%
+1 −0
Q&A Scanner fails when executing Java with admin rights (sudo) in Eclipse in Linux

I've finally managed to get it working without using a wrapper for java. It has to do with filesystem capabilities in Linux. To let java list and select network interfaces, as well as analyse and ...

posted 8d ago by aura-lsprog-86‭

Answer
#1: Initial revision by user avatar aura-lsprog-86‭ · 2025-02-14T02:00:23Z (8 days ago)
I've finally managed to get it working without using a wrapper for `java`. It has to do with filesystem capabilities in Linux.

To let `java` list and select network interfaces, as well as analyse and capture packets, go to the directory where the executable the IDE uses is (for example, `/usr/lib/jvm/java-8-oracle/bin`; in Eclipse you can get it by seeing the console titlebar) and run the following command before doing so with your project:

    sudo setcap cap_net_raw,cap_net_admin=eip java

Then run your project. Once you have tested your project, run the following command to leave things as they were before:

    sudo setcap -r java

You can see if capabilities have been applied/removed by running:

    getcap java

See [this](http://www.tcpdump.org/manpages/pcap.3pcap.html) for more information regarding Linux behaviour when opening interfaces, and [here](http://peternixon.net/news/2012/01/28/configure-tcpdump-work-non-root-user-opensuse-using-file-system-capabilities/) is a complete procedure in case you have to configure something.