Frequently Asked Question
Running iftop without root
Last Updated 5 years ago
iftop is a great tool for diagnosing connections, its like a live netstat but with some limited charting added in at no extra cost. However, to run it requires the ability to sniff the network interface, and that's restricted to root.
Resolving this is simply however, you just need to give the capabilities to the program.
setcap cap_net_raw,cap_net_admin=eip /usr/sbin/iftop
Should add cap_net_raw_cap for any user to /usr/sbin/iftop. You can use the same format to add capabilities to other programs, but you must be careful that every addition could add weakness to the system security.
Resolving this is simply however, you just need to give the capabilities to the program.
setcap cap_net_raw,cap_net_admin=eip /usr/sbin/iftop
Should add cap_net_raw_cap for any user to /usr/sbin/iftop. You can use the same format to add capabilities to other programs, but you must be careful that every addition could add weakness to the system security.