Skip to content

Instantly share code, notes, and snippets.

@mrdomino
Created December 5, 2016 14:40
Show Gist options
  • Save mrdomino/9d16947229cd50c7ef0ef045fbc769a4 to your computer and use it in GitHub Desktop.
Save mrdomino/9d16947229cd50c7ef0ef045fbc769a4 to your computer and use it in GitHub Desktop.
run firefox as a separate user in openbsd
#!/bin/sh
set -eu
tmpfile=$(mktemp)
xauth -q -f $tmpfile generate $DISPLAY . untrusted
xauth_data=$(xauth -f $tmpfile nlist $DISPLAY)
rm -f $tmpfile
DOAS_XAUTH="xauth -q remove $DISPLAY ; echo $xauth_data | xauth nmerge - ;"
export DOAS_XAUTH
doas -u firefox sh -c 'export HOME=/home/firefox ; eval $DOAS_XAUTH ; unset DOAS_XAUTH ; /usr/local/bin/firefox'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment