2012-07-02

Run tcpdump with user privileges

There is no need to acquire superuser privileges each time you need to perform some low level tasks. On my system I tend to allow programs like tcpdump, iftop, and some other "safe" programs to have access to required low level features by setting appropriate capability set on their executables.

The following command allows any non-root user to run tcpdump:

 sudo apt-get install libcap2-bin
 sudo setcap CAP_NET_RAW+ep /usr/sbin/tcpdump

  • CAP_NET_RAW - low-level network access capability
  • +ep - enable given capability as Effective an Permitted

User can exploit those programs to:

  • access sensitive data,
  • perform DOS attacks
  • perform man in the middle attacks
For example tcpdump could be exploited to inject alien packets in network traffic.