Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Could you please show us the full output? –  quanta Sep 4 '12 at 16:15
    
the first file is created fine but when it tried to create a second file, it error with this error: tcpdump: test.dmp: Permission denied –  Sean Nguyen Sep 4 '12 at 16:26
    
I found a bug report for it bugs.centos.org/view.php?id=1570 but i can't find a solution. I am using centos 6. –  Sean Nguyen Sep 4 '12 at 16:28
    
Which tcpdump version are you using? –  quanta Sep 4 '12 at 17:00
    
Could you be starting the second process a little early such that the file is still open in the first tcpdump while trying the second dump. Maybe a sleep 1 between the two invokations might help. –  mdpc Sep 4 '12 at 19:34
add comment

1 Answer 1

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.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.