Last active
August 29, 2015 13:56
-
-
Save staaldraad/8976324 to your computer and use it in GitHub Desktop.
Run wireshark without having to be root
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" != "" ]; then | |
USERNAME=$1 | |
else | |
echo "ERROR: no username supplied" | |
echo "Using current user" | |
USERNAME=`whoami` | |
fi | |
### Ubuntu: | |
# apt-get install libcap2-bin | |
sudo groupadd wireshark | |
sudo usermod -a -G wireshark $USERNAME | |
echo "Setting perms on dumpcap, change /usr/bin to /usr/sbin if needed" | |
sudo chgrp wireshark /usr/bin/dumpcap | |
sudo chmod 754 /usr/bin/dumpcap | |
sudo setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap | |
echo "Checking if cap has been set:" | |
sudo getcap /usr/bin/dumpcap | |
echo "Ensuring user has been added to wireshark group" | |
sudo -u $USERNAME newgrp wireshark |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment