Sunday, 12 December 2010

File Sharing Options In Ubuntu

Since October was my last post on this blog I thought it was about time I posted something at least somewhat useful. As someone who owns several PCs something that interests me is networking those PCs together so that they may share files and common resources. This is actually something many people struggle with all the time. For those who can't solve the problem they may resort to cumbersome methods like using USB sticks. So what are the file sharing options available to Ubuntu users?

Well as I've just mentioned, you can use USB sticks. It's a reliable method guaranteed to work. It is not however terribly efficient. The next option involves networking and there are 3 main ways to share files over a network in Ubuntu. We have Samba, which is an implementation of Microsoft's networking protocols for Windows. Next we have NFS which is commonly used in most POSIX compliant OS's. The third and final option in the "cloud".

Samba is great. When it works. Not only does it allow other Linux machines to share files and other resources like printers. It also allows both Linux and Windows machines to share the same resources on the same network. Which is great. When it works.

And that is the biggest con for me when it comes to Samba. Not only did the Samba developers succeed in developing software that could network both Linux and Windows PCs together on the same network using Microsoft's SMB protocols. They also succeeded in reproducing the reliability of Microsoft's networking protocols. It could just be my incompetence. But frankly I've never been able to get a home network to actually work reliably with Windows and Samba has never work consistently and reliably for me in Ubuntu either.

I will however concede that there are many people who do appear to have Samba working just fine. Another advantage is that shares are dynamic and browse-able. By that I mean a new share will appear on the network as they are made available.

So Samba is flexible but not reliable.

NFS or Network File System on the surface looks a bit scary. Setting it up requires using something called the "terminal" and editing "configuration files" with "root privileges"! For the purposes of a home network based on Ubuntu machines it's actually very simple. Install 3 packages and reboot the PC. Then you can start sharing stuff. Which is where you need to start editing files. Well actually you don't.

Ubuntu has a GUI that lets you select shares for either NFS or Samba. It can be found in System>Administration>Shared Folders. In the case of NFS this will create all the entries in the /etc/exports file for you. All you need do is supply the basic information. The folder to be shared and the clients (other PC's) who have access to it. Editing the /etc/exports file directly does however give more flexibility and certainly isn't something any home user should shy away from. Simply make a copy of the original file. That way if you screw things up, it's easy to fix.

One of the biggest draw backs for me using NFS is that it's static or not browse-able. At least as of yet I haven't found a way to browse through a PC's NFS shares. Each and every share on the network needs to be "mounted" manually or via the fstab file for automatic mounting at boot time. Which can be inconvenient if you can't remember the exact name of the share. I also haven't yet figured out how to share a printer with NFS. If it's even possible.

NFS server and client software is available for Windows. However I've never used it and therefore can't vouch for it.

So NFS is reliable but inflexible.

The Cloud Services
There are at least two "cloud" based file sharing services that spring to mind when it comes to Ubuntu. The first is Canonical's own service. Ubuntu One. This is installed by default in Ubuntu 10.10 as part of Canonical's "social from the start" initiative. You do however still need to create a user account.

The other service and probably more popular service is DropBox. DropBox is the more mature and better established of the two services. Which means more of the bugs have been ironed out. I've used both services and DropBox is definitely my choice for the moment.

The thing that interests me most about these services is the ability to share files securely wherever there is an Internet connection. Not only do they share files but they synchronise them as well. Which means the latest version of a document should always be available. There is a significant limitation however. Cost!

Unlike using Samba or NFS to share resources on a home network using a cloud service limits the amount of data you can share at any given time. That's because the cloud services operate by copying the files to an on-line storage space and then to each client. This on-line storage needs to be paid for by someone.

Users do however get some free storage space. With DropBox it's 2GB and with Ubuntu One it was 1GB when I tried it. Which in today's world of massive MP3 libraries, digital photos and perfectly legally ripped DVDs isn't much. Once you've reached your reached the limits of your on-line storage capacity you must move files out of the shared space or pay up actual real money for more space. On a monthly or annual basis. Which means you're actually paying good money to access your own files.

On the plus side however these services do tend to "just work". Which is why they are popular and why people are actually prepared to shell out money to get that extra storage capacity. Cloud services are also said to have another important function. Off site back up. In reality this only works if you go to the trouble of setting it up that way. Remember these services automatically synchronise their shares. So if you delete a file in the shared space on your laptop. It will be deleted in the shared space on your desktop as well. However as a cheap off site back up option it's not a bad idea.

So cloud based file sharing services are reliable, flexible, browse-able but potentially expensive.

The Conclusion
Each file sharing option here has it's pros and cons. The important thing for people to realise is there are options out there. You don't have to stick with a one size fits all and doesn't actually work properly for anybody solution. My solution is to use a combination of services. I use DropBox for files I need access to when I'm not at home and can't connect via my own home network. And I use NFS for my home network.

I have chosen these options for their reliability and simplicity. They both "just work" and very rarely throw up any problems. Not having figured out how to share a printer with NFS at the moment if it's even possible isn't a huge issue. In the modern age why are we still printing stuff anyway? There's no real "need".