This is an extension of the question by @Andrei
How to mount remote SSHFS via intermediate machine? Tunneling?
I'm in the same situation that I want to mount a remote directory, however the difference is that both machines A
and B
are not publicly exposed on the internet. A
is my local work station.
So I can neither ssh from A -> B
, nor B -> A
.
What I regularly do, is establish a reverse connection from B -> C
, where C
is a rented virtual server (VPS). A script doing this connection (and reconnecting in case of lost connection) is started via the @reboot
key of cron
.
user@pcB $ ssh -R 2048:localhost:22 -p<port> user@serverC
Then, to go from A -> B
I take the intermediate route A -> C -> B
.
user@pcA $ ssh serverC
user@serverC $ ssh -p 2048 user@localhost
user@pcB $ # okay, logged in.
I'm looking for a way to mount the directory pcB:/home/user
on pcA
.
How do I connect to a pc through another pc using ssh is similar, but the solutions provided don't work in this scenario: the connection map in my case is A -> C <- B
not A -> C -> B
.