Skip to content

Instantly share code, notes, and snippets.

@icgood
Last active March 7, 2023 21:59
Show Gist options
  • Save icgood/1346389 to your computer and use it in GitHub Desktop.
Save icgood/1346389 to your computer and use it in GitHub Desktop.
Creates a separate, incognito Chrome/Chromium browser instance, proxied through the given SSH host to maximize privacy.
#!/bin/bash
APPLICATION="chromium"
which google-chrome
if [ $? -eq 0 ]; then
APPLICATION="google-chrome"
fi
HOST="$1"
if [ "x$HOST" = x ]; then
echo "usage: $0 <ssh-host>"
exit 1
fi
ssh -N -D localhost:54321 $HOST &
trap 'for pid in "`pgrep -f "ssh -N -D localhost:54321"`"; do kill $pid; done' INT TERM EXIT
sleep 1
PROXY_PATH="$HOME/.proxy-$APPLICATION"
mkdir -p $PROXY_PATH
$APPLICATION --user-data-dir=$PROXY_PATH --proxy-server="socks://localhost:54321" --incognito
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment