"tcpdump -w 1.pcap";工作正常,但"tcpdump -C 100 -w 1.pcap" - 没有权限 [英] "tcpdump -w 1.pcap" works, but "tcpdump -C 100 -w 1.pcap" - permission denied
问题描述
当我运行"tcpdump -w 1.pcap"时,我需要限制文件大小.我尝试使用键"-C"执行此操作,但是当我添加键时,出现错误权限被拒绝".所以:
I need to limit file size when I run "tcpdump -w 1.pcap". I try to do this with the key "-C", but when I add it I get error "permission denied". So:
> sudo tcpdump -w 1.pcap
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
^C821 packets captured
847 packets received by filter
24 packets dropped by kernel
但是:
> sudo tcpdump -C 100 -w 1.pcap
tcpdump: 1.pcap: Permission denied
我从主目录运行该命令,并尝试以不同的权限运行该命令之前删除并创建文件,最后我拥有:
I run the command from my home directory and I tried to remove and create the file before running the command with different permissions, finally I have:
-rwxrwxrwx 1 root root 0 Aug 5 10:30 1.pcap
或
-rwxrwxrwx 1 fd8 users 0 Aug 5 10:30 1.pcap
您能建议为什么在第二种情况下我无法写入文件吗?
Could you suggest why in the second case I can't write to the file?
推荐答案
当我尝试从文件中读取内容时遇到了类似的问题,例如
I experienced similar problems when I tried to read from file, like
tcpdump -r example.cap 'icmp[icmptype] = icmp-echo'
对我来说,AppArmor导致了我不得不在"tcpdump"上从强制"模式切换到投诉"模式的问题.以超级用户身份运行以下命令:
For me AppArmor caused the problem I had to switch from 'enforcement' mode to 'complain' mode on 'tcpdump'. Run the following command as root:
aa-complain /usr/sbin/tcpdump
这篇关于"tcpdump -w 1.pcap";工作正常,但"tcpdump -C 100 -w 1.pcap" - 没有权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!