I have two remote servers: s1 and s2. s1 accept all connections, s2 only accept connections from s1.

I want to transfer files 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 an ssh connection to s2 with an ssh tunnel to s1. But I couldn't find a way 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 the terminal, but I don't know how to transfer files.

Is there software in Mac like WinSCP in Windows that supports ssh with tunnel?

1 Answer 1


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: your-user@your-server-ip

Okay let's break that down.

2121: That's the local port you will open on your device which links to the FTP server. 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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.