tcpdump failed withi permission denied on centos when using with rotated file option

When I use tcpdump on centos 6, I got a permission denied error even when I was root. My command is like this:

sudo tcpdump -i eth0 -G 10 -w test.dmp port 80

i have tried with -Z root or -Z my_username but no luck

sudo tcpdump -i eth0 -Z root -G 10 -w test.dmp port 80
sudo tcpdump -i eth0 -Z myuser_name -G 10 -w test.dmp port 80

Does anybody know how to make it work?


If you plan to use file rotation, make sure the directory you write into is world writable.

tcpdump drops privileges shortly after opening the first file specified for writing with -w, so it will not be able to write to a directory if:

  1. it doesn't own or isn't a part of the owning group of the directory or
  2. that directory is not world-writable.