My university has access to some academic journals that I cannot access from home. To be able to download papers while I am away, my current proccess is:
Create an ssh tunnel to my university computer with
ssh -D 12345 [email protected]Launch a new instance of Firefox using a separate profile that I configured to use that tunnel as a proxy:
firefox -P uniprofile -no-remote. This way I can still have other windows open that don't send traffic to my uni.Once I am done downloading my papers, I exit firefox and close my ssh connection.
What I can't figure out is how bundle all of this up into a single script so that I can create a desktop launcher that sets up the tunnel (prompting me for the password), launches firefox when that is done and then closes the ssh connection when I close the firefox window. My first attempt was to simply create a script with the ssh command followed by the firefox command but what ended up happening is that firefox only gets launched after I close the ssh connection.
#!/bin/bash
set -e
ssh -D 12345 [email protected]
firefox -P uniprofile -no-remote
#...and at this point find a way to close the ssh connection...