I have a fair amount of music that I want to be able to access both at home and at work (I also like to have an offsite backup). Since I now have a gateway both at work and at home, I'm not able to directly connect the machines to use rsync to keep the music stores up to date. I've put this together and set up a cron job to automatically manage it all:
ssh -R 2201:localhost:22 filesync@shell2.strav.net "ssh -R 2201:localhost:2201 user@mp3server" \"rsync -e 'ssh -p 2201' --stats --progress -a 'path_on_mp3server' root@localhost:'path_on_localhost'\""
I have also used this to set up a background session
ssh -f -N -T -R 1443:localhost:443 user@hostname
The -f switch tells ssh to background itself after authentication. The -N switch creates the tunnel without running any remote commands and the -T switch disables pseudo-tty allocation