Wireshark设置interface 时提示“There are no interfaces on which a capture can be done ”

来源:互联网 发布:java redis博客园 编辑:程序博客网 时间:2024/05/08 16:30
今天在电脑上安装了WIRESHARK软件,在设置interface 时提示"There are no interfaces on which a capture can be done"  提示没有任何一个网络接口准备好。此提示明显是不对的, 我的网卡明明可以正常上网,网络接口怎么会没有准备好呢?  想着应该是和linux下的普通用户权限有关系。上网google了一下,找到了解决问题的方法, 现在整理下来, 以备后用。
 
  思路;即然问题与权限有关系 , 那么解决方法无法有两点, 一个就是直接使用root登陆,这样就可以有足够的权限运行任意程序了, 但显然是不安全的,另外一种方法是通过suid guid等办法给予普通用户执行wireshark的权限。这样相对来说比安全。

  第一种方法:使用root用户登陆
       xiaoshancun@xiaoshancun-VM500:~$ sudo wireshark 
  第二种方法: 通过guid形式使当前普通用户可以运行此程序。
       root@xiaoshancun-VM500:~# groupadd  -g 130  wireshark
       #  新建一个名为wireshark的用户组, 130 是GID,此数字不是固定不变的, 请先查看/etc/group 文件查看最大的GID是多少,然后加1即可。
      root@xiaoshancun-VM500:~# usermod  -a -G wireshark  xiaoshancun  
      #  将当前用户 xiaoshancun 添加到wireshark组中。 使之成为新的组员。
     root@xiaoshancun-VM500:~# chgrp  wireshark   /usr/bin/dumpcap
     #  将/usr/bin/dumpcap  程序的属组更改为wireshark  。
      root@xiaoshancun-VM500:~# chmod  4750 /usr/bin/dumpcap
     修改 /usr/bin/dumpcap  的权限 更改为  4750  添加suid 权限 。 
      root@xiaoshancun-VM500:~# setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap 
      
     修改完成还不能直接使用,需要重新登陆一下才可以。需你不想重新登陆可以使用如下命令。
     root@xiaoshancun-VM500:~#  newgrp wireshark
   完屔后就可以使用普通用户执行wireshark 程序了。 
   Wireshark设置interface 时提示“There are no interfaces on which a capture can be done ” - 明天的阳光 - 明天的阳光

0 0
原创粉丝点击