I would like to run an application (call it firefox) on my work machine. The problem is that I need to do some complicated ssh tunelling to get access to it as access to the machine is blocked from the outside and some ports are also blocked internally. So I do the following.
ssh -v -L 1200:serverC:22 user@serverB (locally) ssh -v -L 5900:127.0.0.1:5900 -p 1200 [email protected] (locally) x11vnc -safer -localhost -nopw -once -display :0 (on serverC) vinagre localhost::5900 (locally) I then run firefox (say) in the vnc window that opens and it all works.
However I would like to have a bash script that does this for me. How can I automate it?
There are two problems.
- I need to stay logged in after each ssh above for the tunelling to work so a simple bash script just stops after the first step.
- I don't know how to get an application to run automatically in a vnc window.
Ideally I would just type "./remote-firefox" (for example) locally to get all this to happen.