TransWikia.com

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

Server Fault Asked on January 18, 2021

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?

3 Answers

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

Correct answer by Linuxx on January 18, 2021

You could use rinetd to acomplish what you want:

apt install rinetd

Then you edit /etc/rinetd.conf, and add your configuration at the end:

SERVER_A_IP SERVER_A_PORT SERVER_B_IP SERVER_B_PORT

Example:

# Server A IP: 192.168.0.1
# Server B IP: 1.2.3.4
# Listen on port 8080 on local server and redirect to 22 on remote server
# Configuration
192.168.0.1 8080 1.2.3.4 22

Finally you restart the service:

systemctl restart rinetd

And connect through SERVER A:

sftp -P 8080  user@SERVER_A_IP

Answered by Mora on January 18, 2021

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.

Answered by billkw on January 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP