Wednesday, March 29, 2006

SSH Tunnels and Multiple Copies of Firefox

I'm currently working from home and need todo some testing of a website that is only accessable from some restricted IPs inside my work offices. To get around this I use and ssh tunnel: ssh -D 1080 -N machine.ox.ac.uk &
  • -D 1080 sets up a SOCKS server listen on localhost, port 1080
  • -N mean no command gets run when the connection is established so it can be run in the background safely (SSH 2)
Once I have connected and authenticate I want to start another copy of Firefox but keep my existing instance of Firefox running for normal browsing. Firefox by default tries to limit you to only one copy being running at any one time and so just starting Firefox up you end up with just another window for your existing instance. There are some other blog posts about running multiple copies of Firefox but they don't have a nice one liner. Mine is: ( export MOZ_NO_REMOTE=1; firefox -profilemanager ) & The brackets mean that a subshell is started so that the MOZ_NO_REMOTE only affects the single firefox instance. This then brings up the profile manager as when running multiple copies of Firefox you have to use a different profile for each one. As I am wanting to test a remote website through the ssh connection I create a new profile called SOCKS and start it. Then once the extra copy of Firefox is running I edit the connection settings (Edit -> Preferences) and specify Manual Proxy Settings with the SOCKS host set to localhost and the port set to 1080. After clicking Ok all my browsing from this copy of Firefox goes through the ssh connection so I can test the IP restricted website without having to run a VPN. The only thing left todo is to install a theme in the SOCKS profile so it is more obvious which profile I am using.