Skip to content

Instantly share code, notes, and snippets.

@tumregels
Last active November 26, 2020 12:09
Show Gist options
  • Save tumregels/a04a62ce717e4a4902176113375087d8 to your computer and use it in GitHub Desktop.
Save tumregels/a04a62ce717e4a4902176113375087d8 to your computer and use it in GitHub Desktop.
ssh socks5 proxy setup with firefox
  1. open ~/.ssh/config and add

     Host socksproxy
         HostName 1.2.3.4
         BatchMode yes
         RequestTTY no
         Compression yes
         DynamicForward localhost:8123
         IdentityFile ~/.ssh/proxy_rsa
         User username
    
  2. open ~/.bashrc and add

     alias socksproxy='/usr/bin/firefox -no-remote -P socksproxy && ssh -nkN socksproxy'
    
  3. open firefox, in the url bar type about:profiles and create a new profile called socksproxy load socksproxy profile open Preferences -> Network Settings -> Manual proxy configuration -> SOCKS Host set to localhost and Port to 8123, under No proxy for add localhost, 127.0.0.1. Activate Proxy DNS when using SOCKS v5 and click ok.

  4. open terminal and type

     $ socksproxy 
    
  5. wait until firefox profile is open and check your ip address. It should be the ip address of the proxy server.

Warning: May show warning Firefox is already running. Just click ok and refresh socksproxy profile of firefox.

For chrome browser to use proxy server open ~/.bashrc and add

    chromeproxy() { /usr/bin/google-chrome --proxy-server="socks5://localhost:8123" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE localhost" "$@" & }

    alias socksproxychrome='chromeproxy && ssh -nkN socksproxy'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment