ubuntu 18.04安装wireshark及网卡接口权限问题

    xiaoxiao2023-10-17  222

    1、安装

    sudo apt-fast install wireshark

    第一次安装过程中可能会提示Should non-superusers be able to capture packets? 选是即可(默认是否)。

    2、待安装成功后,你会发现可以直接运行wireshark了,但是找不到网络接口,因此无法进行抓包。此时,只需用root权限运行软件即可。

    sudo wireshark

    3、直接以root权限运行软件除了不方便,也很危险。可以通过用户组的功能让普通用户也可以读取网卡接口,这样就不必用root权限执行了。

    (1)添加wireshark用户组

    sudo groupadd wireshark

    (2)将dumpcap更改为wireshark用户组

    sudo chgrp wireshark /usr/bin/dumpcap

    (3)让wireshark用户组有root权限使用dumpcap

    sudo chmod 4755 /usr/bin/dumpcap

    (注意:如果设为4754 Wireshark还是会提示没有权限 )

    (4)将需要使用的普通用户名加入wireshark用户组,假设用户名为是“username”(需要根据具体用户名修改!),则需要使用命令:

    sudo gpasswd -a username wireshark

    这样就完成了,以普通用户username登陆打开Wireshark就会有权限进行抓包了。 (此处参考这里)。 4、如果在安装时弹出的那个窗口不小心点了否,没有关系,通过下面的这个命令可以再把它调出来重新选即可。

    sudo dpkg-reconfigure wireshark-common “Should non-superusers be able to capturepackages?”
    最新回复(0)