Skip to content

Instantly share code, notes, and snippets.

@lenciel
Last active December 6, 2022 07:59
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lenciel/d353a04a3a7bc0278ec6 to your computer and use it in GitHub Desktop.
Save lenciel/d353a04a3a7bc0278ec6 to your computer and use it in GitHub Desktop.
autossh plist file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>autossh.lenciel</string>
<key>ProgramArguments</key>
<array>
<string>/opt/boxen/homebrew/bin/autossh</string>
<string>-M</string>
<string>20000</string>
<string>-f</string>
<string>-i</string>
<string>~/.ssh/fuckgfw</string>
<string>-N</string>
<string>-L</string>
<string>0.0.0.0:3189:localhost:31280</string>
<string>remotehost</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>/opt/boxen/</string>
<key>StandardErrorPath</key>
<string>/opt/boxen/log/autossh/autossh.log</string>
</dict>
</plist>
@lenciel
Copy link
Author

lenciel commented Jul 11, 2014

This is a plist file for starting autossh automatically after you login to your Mac.

To use:

  • Install autossh

    $ brew install autossh
    
  • Ensure you have passwordless ssh between yourself and your remote server

  • Change /opt/boxen/homebrew/bin/autossh to the output of which autossh

  • Change the string after -i (it is fuckgfw now) to your private key file name if you have

  • Change the string remotehost to the host which save your ass

  • Modify the logging related configuration if you don't use boxen . Or remove the block completely if you don't want to see any log

  • Copy the above gist to ~/Library/LaunchAgents/autossh.lenciel.plist

  • Ask OSX to launch autossh every time you log in:

$ launchctl load ~/Library/LaunchAgents/autossh.lenciel.plist

After this you might need to setup your browser or tell OSX to use the encrypted connection globally by : System Preferences ➡ Network ➡ Advanced ➡ Proxies

Change at least the Web Proxy (HTTP), Secure Web Proxy (HTTPS), and FTP Proxy entries and enjoy it.

@got3nks
Copy link

got3nks commented Apr 25, 2020

Thanks a lot for sharing it!

In my case, I had to remove -f from the options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment