Transferring Files Between Two Separate (not connected to the same network) Computers

file-sharingNetworknetwork-userssh

I need to send a colleague a relatively large application (>5GB), and was thinking of how I could go about sending it. Cloud-based services such as DropBox won't work because the file is much bigger than the storage, Gmail won't allow me to send files larger than 25Mb, and using a regular USB Flash Drive would take much too long.

What I want to know if it is possible to transfer the files between the two computers without needing to be on the same network (For reference both of us are using MacBook Pro's, and we're a couple of states apart). I've tried using
telnet,
ssh, and
ftp, but it seems that all of them require the two computers to be part of the same local area network (I was trying to have the other end connect to my computer by giving them the IP address of my computer). I was wondering if it were possible to somehow make my MacBook act as a server, have the other end connect, and then transfer the files. Is something like this feasible? Thank you in advance!

Best Answer

The classic way of copying files between two *NIX boxes (Mac, BSD or some Linux) is via the scp command.

This method requires knowledge of the public IP address of the target device, or an IP address within the same VPN. A tool which can help accessing computers over the internet is a Dynamic DNS service, like No-IP or DynDNS. No-IP offers a free service which is more than adequate for your purposes (used it myself). This gives your machine a publicly accessible hostname.

Once you've established the target device's IP, you need to fire up your Terminal, and call the scp command. For the sake of simplicity we'll assume that the target IP is 8.8.8.8, and that you've already set up SSH keys.

Your scp command should look something like this:

>> scp /source/file/here remoteuser@8.8.8.8:/target/file/here

or when using a hostname:

>> scp /source/file/here remoteuser@hostname.net:/target/file/here

If you check scp man pages, it tells you that the first parameter (the source file) should also be defined with a user and a machine. When using a local file, the necessary details are added for you, so you only have to provide the file path.

Here is a link to the scp man page: http://linux.die.net/man/1/scp

And here's a link to a tutorial: https://kb.iu.edu/d/agye

Bonus: if you need to sync a larger number of files more often, maybe something like BitTorrent Sync could be of interest to you. I haven't really tried it myself with larger files tho.