linux下wireshark不用sudo權限抓包包

ubuntu安裝了wireshark,發現打不開網絡接口,後來從網上得知要用sudo從命令行執行,確實可以,但是執行過程中一直要開一個命令行窗口,不爽,想直接用單擊圖標的方法運行之,在網上查詢找到以下兩個方法,首先使用的是方法1,未成功,又使用了方法2,仍未成功,突然想到是不是要重啓呢?重啓後,一切ok!

我也就不知道是哪個方法起的作用了,也許都有效。記得重啓哦,親!

 

1.這個主要涉及到安全的問題,可以開啓非超級用戶模式,這樣就可以直接使用普通用戶進行包採集了。具體操作如下:

sudo dpkg-reconfigurewireshark-common(出現一個帶顏色的對話框,用方向鍵把紅色指示塊移到YES上回車就ok了)

sudo adduser yournamewireshark (把yourname換成你自己的用戶名)

這樣就可以了~~

 

2.

First, create awireshark group

 

:~$ sudo groupaddwireshark

 

Second, add yourusername to the wireshark group

 

:~$ sudo usermod -a -Gwireshark yourusername

 

Third, change groupownership of dumpcap to wireshark group

 

:~$ sudo chgrpwireshark /usr/bin/dumpcap

 

Fourth, set filepermissions of dumpcap to 754 (rwx for user, r-x for group)

 

:~$ sudo chmod 754/usr/bin/dumpcap

 

Fifth, enable filecapabilities for dumpcap

 

:~$ sudo setcap'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/dumpcap

 

You may also need torun dpkg-reconfigure for wireshark-common if you install wireshark or tshark asa package through Synaptic and enable packet capture for non-root users

 

:~$ sudodpkg-reconfigure wireshark-common

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章