Skip to content

Instantly share code, notes, and snippets.

@staaldraad
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save staaldraad/8976324 to your computer and use it in GitHub Desktop.
Save staaldraad/8976324 to your computer and use it in GitHub Desktop.
Run wireshark without having to be root
#!/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