Mounting a file system over the internet

I built a web application that runs on a virtual server for one of my customers. It includes the facility for them to upload files, but they now want to store those files on a server in their office.

The easiest way to do this would be to mount their file system over the internet directly onto the virtual server. I have experience of mounting NFS over an internal network, but I am not clear if it would work in this scenario.

Any thoughts? I can always write new software to transfer the files, but this would be an easy fix!

Note: The server in the office is Ubuntu 12 server running on a virtual server in a windows hyper-v environment. The VPS with the web app is Ubuntu 11.04


Solution 1:

No one has mentioned sshfs yet. If you're on a modern linux distro and have ssh access to the remote host, it's as simple as:

sshfs user@hostname:/remote/directory /local/directory

Performance is quite acceptable (but not nearly as fast as a streamed sync like rsync if you require the whole directory).

Solution 2:

NFS is inherently insecure. It would be a very poor choice for connecting over the internet.

I like the post that mentions rsync. Instead of using cron to fire the transfer, I would hope that you could simply run the rsync job from your code that handles the file upload.

When the upload completes, rsync the file to their server, done.

You would need to set up a secure connection to their server for the transfer, I would expect.

If you wanted to, you could put the incoming files into a list for transfer, removing the names after successful copy, and give yourself some fail over capability, in case something happens to the connection.

As someone else already pointed out, rsync is designed to handle groups of files, or a hierarchy (thanks, spell check) , so this wouldn't be that hard to accomplish.