为了定位问题,需要在Linux上使用tcpdump并且保存到文件,遇到了如下问题:

tcpdump port 9001 -w xx
tcpdump: xx: Permission denied

因为已经是root用户,所以判断不是文件系统权限的问题。

在网上查了一下,找到解决方法:将tcpdump的模式从enforce改为complain模式。

修改过程如下:

先查看处在那个模式:

grep tcpdump /sys/kernel/security/apparmor/profiles
/usr/sbin/tcpdump (enforce)

果然不是complain模式。

修改为complain模式:

aa-complain /usr/sbin/tcpdump
The program 'aa-complain' is currently not installed.  You can install it by typing:
apt-get install apparmor-utils

出现错误,按照提示安装apparmor-utils,过程略,然后再次执行:

aa-complain /usr/sbin/tcpdump
Setting /usr/sbin/tcpdump to complain mode.

查看:

grep tcpdump /sys/kernel/security/apparmor/profiles
/usr/sbin/tcpdump (complain)

完成

参考:

tcpdump permission denied:https://ubuntuforums.org/showthread.php?t=1501339

页面内容比较多,关键信息如下:

This is probably caused by AppArmor. You need to switch from 'enforcement' mode to 'complain' mode on 'tcpdump'. Run the following command as root:

Code:

aa-complain /usr/sbin/tcpdump

You can check by running the following command as root:

Code:

grep tcpdump /sys/kernel/security/apparmor/profiles

You should see (enforce) or (complain). You want it to say (complain).

AppArmor介绍:http://www.tuicool.com/articles/aeiIzq

Linux版本:Linux 10-6-13-14 3.2.0-85-generic #122-Ubuntu SMP Tue May 26 16:14:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

当 tcpdump -w 遇到 Permission denied的更多相关文章

  1. Android Studio:Unable to add window android.view.ViewRootImpl$W@5e2d85a -- permission denied for this window 第一行代码

    学习<第一行代码>的时候,出现的错误. java.lang.RuntimeException: Unable to start receiver com.example.sevenun.l ...

  2. Android - Unable to add window android.view.ViewRootImpl$W@6518342 -- permission denied for window type 2133

    因为跟博主碰到了一样的问题,所以记录一下分析原理 原文链接:https://www.jianshu.com/p/b0364074288a 首先,先介绍下背景环境,第一,是Android7.0,其次,要 ...

  3. WindowManager$BadTokenException: Unable to add window permission denied for this window type

    10-11 11:47:27.472: E/AndroidRuntime(12804): java.lang.RuntimeException: Unable to start activity Co ...

  4. 【转】adb控台中Permission denied的解决方案

    原文网址:http://blog.csdn.net/wkl305268748/article/details/13504171 [前提]手机一定要root 在控制台中想要将电脑上c盘中的tcpdump ...

  5. 解决从内部存储设备安装apk提示Permission Denied

    做应用商店,下载apk,考虑一种情况,如果没有sd卡的情况下就将apk下载到 Internal Cache目录下. 下载都正常,但是在安装的时候提示Permission Denied /data/da ...

  6. [转]adb pull Permission denied及no such file错误

    adb pull  Permission denied及no such file错误 http://www.the8m.com/blog/article/javadk/adbpull.html XP系 ...

  7. sqlplus时报Linux-x86_64 Error: 13: Permission denied

    在本机上非oracle用户运行sqlplus时,报以下错误:[cpdds@node1 ~]$ sqlplus cpdds_pdata/cpdds_pdata SQL*Plus: Release 10. ...

  8. hadoop 权限错误 Permission denied: user=root, access=WRITE, inode="/":hdfs:super

    关于不能执行Hadoop命令 并报权限问题执行错误1.Permission denied: user=root, access=WRITE, inode="/":hdfs:supe ...

  9. OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration'

    使用Hortonworks 的twitter tutorial: http://hortonworks.com/hadoop-tutorial/how-to-refine-and-visualize- ...

随机推荐

  1. devexpress 中Grid 的使用:为零不显示

    如果要让为0的列不显示: this.gridColumn_FAmount.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; ...

  2. C#调用C++ DLL类方法(转)

    http://hi.baidu.com/game_dev/item/ba29ecf67bd5f6cf521c26fc

  3. Mongodb 和 普通数据库 各种属性 和语句 的对应

    SQL to MongoDB Mapping Chart In addition to the charts that follow, you might want to consider the F ...

  4. 利用XSD配合XSLT產出特定格式Word檔案 -摘自网络

    利用類別產生XSD檔 產出XSD檔的目的在於提供Word樣板設計之資料框架 在此使用微軟提供之XML Schema Definition Tool (Xsd.exe)工具產生XSD檔 1. 定義類別 ...

  5. Android-Native-Server 启动和注册详细分析

    Android-Native-Server 启动和注册详细分析     以mediaService为实例来讲解: mediaService的启动入口 是一个 传统的  main()函数 源码位置E:\ ...

  6. Android uiautomator实例使用

    转载自:http://blog.csdn.net/huiguixian/article/details/22398193 Android测试工具中,Monkey Runner只要简单几个指令即可,但他 ...

  7. Hadoop MapReduce概念学习系列之mr程序详谈(二十三)

    这个暂时,没写好. K1,v1 这是增强的for循环. for(Sting w : words) { } 迭代器里,前面,放的是什么类型,后面,迭代的是谁.

  8. [Objective-c 基础 - 2.6] @property和@synthesize

    Xcode编译器的特性,自动生成getter和setter   A.@property 自动生成某个成员变量的getter和setter的声明 变量的命名要求:以下划线开头 Student.h @in ...

  9. 类型检测汇总!typeof 和 instanceof 和isArray

    , ]; alert(arr instanceof Array);//true 以上老方法判断是否是数组,存在一个问题,就是它只适用于单执行环境(窗口),如果该窗口有其他框架(比如 iframe)则会 ...

  10. mysql之字符集与校对集

    一.字符集 1.mysql的字符集设置非常灵活 可以设置服务器默认字符集: 数据库默认字符集: 表默认字符集: 列字符集: 如果某一级别没有指定字符集,则继承上一级. 查看所有字符集语句:show c ...