-   Linux - Software (
-   -   NFS or FTP for file transfer (

softstag 06-10-2011 04:31 AM

NFS or FTP for file transfer
I'm in the process of setting up 2 Debian servers that are linked on a LAN and both have public and private IPs. Both servers will need to share some files for use within their web applications that they serve. They may need to write as well as read files.

I am using PHP as the scripting, and I see 2 possible solutions for accessing files on one server from another - NFS and FTP. Files will mainly be images of 0.5 - 1.5 Mb. I've done some research, and the advice out there is confusing. Some say NFS is faster, some say FTP. So I wonder if you can help with my quandary? To mount an NFS drive on the other server, or to setup FTP an call directly from within my PHP scripts?

Thanks in advance

zordrak 06-10-2011 05:30 AM

From how you describe it NFS is definitely the way to go, but while there are alternatives I don't think FTP is an appropriate one. sshfs for example would be one way to go - but either way it's still a local mount of a share on a remote server; nfs is probably best if both servers have the same user database.

softstag 06-10-2011 06:07 AM

Thanks for your reply Zordrak. I was thinking NFS as well, but some sites are saying FTP is better. I can see FTP being better where the servers are accessed via the internet. I will take a look at sshfs as well.

Any other comments are most welcome!

wpeckham 06-10-2011 11:39 AM

FTP should only be used for traffic that will not exit your local network or VPN environment. IT is not suitable for general internet use, as it passes security information (logon and password) in the clear (unencrypted). If your traffic may hit the internet, try sftp or rsync over ssh: these encrypt ALL of the traffic.

NFS, while very useful, is an old insecure protocol that suffers several reliability problems. Again, that should not rule it out if all of the NFS traffic will be local or VPN secured. NFS over 1000BT dedicated links performs nicely.

softstag 06-11-2011 01:22 AM

Thanks Wpeckham.

The file transfer will be on a local network, and secure from the outside world. I guess there is no compelling argument to use one over the other? Unless anyone can think of any?

wpeckham 06-12-2011 08:10 AM

It depends upon HOW you want to use it.
sftp is easier to automate than ftp, but neither is rocket science.
I have had NFS (and some ftp transfers) kinda 'bork' on very large files.
There are performance issues, but on recent machines on a local LAN they are unimportant.
If the files are all under a gig, use what you find easiest.

If you decide to use an ftp server, check into lftp as the client. It has some powerful options for scripting and automation, and does more than the simple ftp protocol.

softstag 06-13-2011 07:00 AM

Thanks Wpeckham for the useful advice :)

All times are GMT -5. The time now is 07:05 AM.