Ubuntu下安装和使用Wireshark


用Ubuntu Software Center安装wireshark还是很容易的,在教育网下使用ipv6的软件源速度也很好。

但是安装完后如果不进行任何设置的话,wireshark还是不能使用。这时打开wireshark会提示“thereare no interfaces on which a capture can be done”。

这是因为在默认情况下,普通用户没有截取网络数据的权限。

当然,可以通过运行sudowireshark,这样可以正常使用wireshark,但这并不是一个好方法,正如wireshark提示的那样:

“Running as user "root" andgroup "root".

This could be dangerous.

If you're running Wireshark this way inorder to perform live capture, you may want to be aware that there isa better way documented at

/usr/share/doc/wireshark-common/README.Debian”

参照/usr/share/doc/wireshark-common/README.Debian和网络上的资料:

wireshark利用了优先级分离(privilegeseparation)的策略,不同的进程会有不同的优先级。

Role
 PrivilegeLevel
 Description
 
Capture
 OS-dependent
 Readslive capture data
 
Dissection
 Non-privilegeduser, possibly chrooted
 Dissectspacket data. The majority of Wireshark's security-related bugshave been in its dissection code.
 
Filesystem
 Normaluser
 Normalfile-handling, e.g. reading and writing capture files,preferences, etc.
 

抓取实时数据的dumpcap进程就需要超级用户的权限。如果想让普通用户也能正常使用wireshark,建议的方法是把用户加入wireshark组,这样当用户运行wireshark时,dumpcap进程会以有高优先级,而其他相关进程仍然只有普通用户的权限。

运行sudo dpkg-reconfigurewireshark-common会创建wireshark用户组。

把需要运行wireshark的用户加入wireshark组:

sudo usermod -a -G wireshark $USER

之后,重新以该用户身份重新登录即可。

相关内容