Hi all! I hacked together a script for managing ssh tunnels and thought I'd share it. Since right now I have better things to do with my time than hand-holding, try to fix problems with this script yourself if you encounter them.

Prerequisites: ssh client + a ssh server you can connect to via public key authentication.
Limitations: Remote and local ports have to have the same number for now. Error reporting is non-existing right now. You need to have public key authentication working to avoid the ssh password prompt.

Usage:
1. Put the script 'sshtunnel' (see further down) somewhere in your PATH and make it executable
2. Run sshtunnel to create initial config files
2. Create a profile: Copy ~/.sshtunnel/profiles/example to ~./sshtunnel/profiles/yourprofile and fill in real parameters. Use ~/.sshtunnel/profiles/default for default values, which are overridden by profile values (even empty ones!).
3. Start a tunnel

Code:

sshtunnel start yourprofile

4. Use the tunnel
5. Stop the tunnel

Code:

sstunnel stop yourprofile

A common usage for this tool (and indeed the reason why I wrote it) would be to get access to a firewalled license server to run a piece of software:

I think this script might be useful for me; however, I'm not sure how to use it. Step 1 references something called sshtunnel. At first I thought that was the name of your script; however, you mention grabbing the sshtunnel example profile. So I then assumed you meant a package called sshtunnel. Running 'emerge -s tunnel' shows 7 results, none of which are sshtunnel.
Where can I get sshtunnel?_________________Athlon 64 3200+, 80G WD sata hd + 200G IDE, 1G Geil DDR400, MSI K8T Neo
IntelCore2Duo 2.0Ghz MSI laptop,100G SATA hd, 2G RAM

(Obviously one can have as many "profile" definitions in the ssh config as needed) Then you would start a tunnel like:

Code:

ssh -Nf mathematica_profile

You can wrap it in a service to keep track of the PID if it's important that you can close it easily. Alternatively, of course, you can omit the -f option and kill the tunnel with Ctrl-C when you don't need it.
And if you need it for one program only then:

Code:

ssh -f mathematica_profile sleep 10; mathematica

The tunnel is kept open until 10 seconds minimum but will stay open as long as mathematica needs it.