Skip to content

Instantly share code, notes, and snippets.

@brycethomas
Created October 15, 2017 02:20
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 brycethomas/f984b7563b5b2acfa79cabfc0b07d041 to your computer and use it in GitHub Desktop.
Save brycethomas/f984b7563b5b2acfa79cabfc0b07d041 to your computer and use it in GitHub Desktop.
Run a command with ambient capabilities
#!/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