I have two remote servers: s1 and s2. s1 accept all connections, s2 only accept connections from s1. I want to transfer file from my MAC to s2, so I have to create a tunnel with s1 and then connect to s2. In Windows I can use WinSCP to create ssh connection to s2 with a ssh tunnel to s1. But I couldn't find a to transfer files in MAC. I can still connect to s2 by ssh to s1 first and then using s1 to ssh to s2 in terminal, but I don't know how to transfer files. Is there a software in MAC like WinSCP in Windows support ssh with tunnel?
Okay, so it's actually built into macOS already. SSH tunnels come with the SSH protocol by default. Windows has poor support for SSH, which is why tools like PuTTY come up. However, all you have to do is open up your Terminal, and type the following command:
ssh -L 2121:127.0.0.1:21 your-user@your-server-ip
Okay let's break that down.
2121: That's the IP address you will open on your device which links to the FTP server.
127.0.0.1: That's the IP address that you're telling your remote server to mirror, A.K.A. localhost for the remote server.
21: That's the actual FTP port on your remote server.
Simple. No app installation required.