为了定位问题,需要在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. 《Genesis-3D开源游戏引擎完整实例教程-跑酷游戏篇05:二段跳》

    5.二段跳 二段跳概述: 基本跑酷游戏的框架搭建完毕,开发者会根据开发的游戏特性,增设一些额外功能,使游戏具有可玩性性和画面感.下面我们以角色的二段跳为例,来了解在跑酷游戏中增设其它功能的流程.二段跳 ...

  2. 【转载】locate命令的使用

    [说明]转载自 http://www.cnblogs.com/flysnail/archive/2012/05/16/2504266.html 使用locate命令,遇到了这样的情况:当前目录下有一个 ...

  3. 【转载】c++中的 extern "C"(讲的更好一些)

    [说明]本文章转载自 东边日出西边雨 的文章http://songpengfei.iteye.com/blog/1100239 ------------------------------------ ...

  4. yum 安装 PHP,apache,nginx,mysql

    如果是Centos OS 64 位,首先更新 rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarc ...

  5. Hadoop概念学习系列之URI深入(三十二)

    ls  /   ------------------------  这是查本地Linux上的根 hadoop fs -ls /   ------------- 这是查hdfs上的根 或者,   had ...

  6. Java面试题集(51-70)

    Java程序员面试题集(51-70) 51.类ExampleA 继承Exception,类ExampleB 继承ExampleA. 有如下代码片断: try{ thrownew ExampleB(“b ...

  7. iOS开发 autoResizingMask使用

    autoResizingMask 是UIView的一个属性,在一些简单的布局中,使用autoResizingMask,可以实现子控件相对于父控件的自动布局. autoResizingMask 是UIV ...

  8. vertical-align:top在单词和中文的表现

    <ul> <li> <img src="../../saasdist_v2/images/staff-img.png" alt="" ...

  9. FindWindow使用方法

    函数功能:该函数获得一个顶层窗体的句柄,该窗体的类名和窗体名与给定的字符串相匹配.这个函数不查找子窗体.在查找时不区分大写和小写. 函数型:HWND FindWindow(LPCTSTR IpClas ...

  10. C++中的new与delete总结

    1. operator new.operator delete与new.delete操作符的区别: operator new的作用类似于malloc,负责分配内存:operator delete的作用 ...