Created
October 15, 2017 02:20
-
-
Save brycethomas/f984b7563b5b2acfa79cabfc0b07d041 to your computer and use it in GitHub Desktop.
Run a command with ambient capabilities
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 | |
# Run from terminal like enter-caps ./wireshark | |
export PS1="#$PS1" | |
export WIRESHARK_RUN_FROM_BUILD_DIRECTORY=1 | |
caps=cap_net_admin,cap_net_raw | |
sudo -E capsh --keep=1 --caps="cap_setuid,cap_setgid,cap_setpcap+ep $caps+eip" --user=[my_hardcoded_username] --addamb="$caps" -- -c "$@" | |
echo "...Exiting enter-caps" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment