Tuesday, August 7, 2012

connecting a tunnel to a reverse ssh connection and mounting with sshfs

I have a machine (treestump) that connects to a server with a known ip address (applecart). treestump opens a reverse proxy connection onto applecart at port 29999. From applecart, I can connect to treestump from applecart by issuing: 'ssh me@localhost -p 29999'. I have password less logins configured.

I'm on my machine here (rainplant). rainplant can't see treestump but does have an account and passwordless login to applecart. I want to mount treestump using sshfs. This requires two steps.

1. Set up a tunnel all the way through to treestump.
    ssh -L localhost:1999:localhost:29999 me@applecart
1.a Test the connection.
    ssh me@localhost -p 1999
2 Mount using sshfs
    sshfs -p 1999 me@localhost:/storage/ ./treestumpstorage

I saw a suggestion to use autossh, this makes sense to me on treestump.