Forward an FTP/SFTP connection to another server (instead of tunneling from the client)

I've been accessing a server's files via Sublime SFTP.

The issue is that I need to tunnel into my destination server via a middle-man server (that I have root access to).

ClientServer A (middle-man node) → Server B (destination node)

Normally I'd use a tunneling option in the client software, but in this case Sublime doesn't seem to have that feature.

What's the best way for me to configure the middle-man server (apache) to accomplish this? (or something like it)

For example, maybe there's a way to automatically have Server A connect to Server B when the client successfully connects to a particular port?


Solution 1:

With HAProxy you can create a TCP proxy to proxy the connection back to the backend server. I do this frequently.

Solution 2:

I would recommend that you use SSH Tunneling.

ssh -L 9999:server_b:22 username@server_a

You'll of course also need to confirm that Server A's firewall accepts inbound TCP connections on your port of choice.