This Cyber Monday Envato Tuts+ courses will be reduced to just $3. Don't miss out.
Sharing files over the internet has never been easier thanks to services such as Dropbox, WeTransfer and even email. Despite this ease at which we can send a file to the other side of the world, sharing files on a local network to the computer across the room is still a complicated affair.
In this tutorial I'll show you how to OS X's built-in File Sharing service to provide a more robust and simpler way of sharing files on a local network.
File Server Complexity
File sharing within a local network has always been somewhat of a complicated process. Even now, the most common method of sharing files is to have a dedicated file server so files can be stored and accessed by users.
Let's imagine we have an office with two users, Jack and Jill. Jack has been working on a video file that Jill now needs to access. Jack must now copy the video to their file server, which takes about ten minutes, and then Jill copies it back to her Mac which takes about the same amount of time.
For files with small sizes, such as text documents and spreadsheets, you can generally open the file directly on the server and then save the changes back. For larger files, such as this video file that Jack and Jill are dealing with, it's generally recommended to copy the file locally to your Mac before editing.
If you attempt to edit the file directly from the server then you're likely to notice a reduction in performance because the speed at which changes can be made is bottlenecked by the network speed. Your Mac's hard drive operates many, many times faster than even the fastest network, so speed issues will occur as any save you make has to be written to the server. If you're working on a video that's 1GB in size, that's a lot of data to continually send over the network. Worse still, should there be any network issues whilst working on the file or saving it, you risk corrupting the data.
File servers have many advantages and the most important of which is that all of your user's data is centrally stored. This makes backup planning much easier, not to mention that all of your users can access any file they might need to.
But for small businesses and home users, these advantages may not be applicable which makes a dedicated file server an unnecessary expense. Luckily, there are a number of ways we can share files between Macs without the need for a dedicated server.
AirDrop was introduced in OS X Lion as a way to easily send files between Macs. Using AirDrop provides one of the simplest ways of transferring files between two different Mac users that are nearby or on the same network.
AirDrop provides a simple drag-and-drop interface for sharing files without having to worry about permissions, servers or anything else that you'd usually have to consider. Put simply, there's no easier way to share files between two different Macs.
Using AirDrop to send a file to another Mac is very simple, provided you have a Mac that supports it.
We've covered AirDrop before on Mactuts+ in our tutorial How to Enable AirDrop on Ethernet Connected and Unsupported Macs, and I'd highly recommend re-visiting it so you can better understand and use this great feature.
AirDrop isn't without its drawbacks and there are some disadvantages to this method of file sharing. First of all, it only works with the more recent versions of OS X and with certain Macs that have built-in Wi-Fi. Our previous tutorial explains how to enable this feature on Macs that aren't officially supported, though if you're slightly wary around the Terminal then it might not be for you.
Secondly, AirDrop requires both the sender and recipient to activate AirDrop, meaning file sharing has to be explicitly accepted by both parties involved. Let's go back to Jack and Jill to explain more.
This time round, Jack and Jill are both using AirDrop-enabled Macs. Jack selects the file he wants to AirDrop and it begins to search for other users with AirDrop enabled. In order for Jill to receive the file, she'll also need to be at her Mac and then select AirDrop from the Finder window also. Whilst this is to ensure that you can't just send an AirDrop file to anybody, if you're users are in a different room or the recipient isn't around to activate AirDrop, there's nothing you can do.
OS X File Sharing
Mac OS X has included the option to enable the File Sharing service, allowing remote users across a network to read and write files to your Mac. With it enabled, you can delegate access to other users to allow them to copy files to and from your Mac, but with the ability to set restrictions and even specific login information.
Let's set up File Sharing in OS X and give other users basic access to our Mac on the network. We're going to need two Macs to do so - one to enable File Sharing on, which we'll call THE Mac Server, and one to use to connect to it, which we'll call the Mac Client.
On the Mac Server, open System Preferences and then select the Sharing preference pane.
You'll see a number of options that you can check that will enable a number of services designed to share your Mac in some way, from the use of its DVD drive to its internet connection. The one we're interested in is File Sharing.
Check the box to enable File Sharing. When enabled, we're given some information about how to access it. In this example, we can access the Mac on the IP address 10.0.1.16 or, perhaps easier, through the Finder window.
With File Sharing enabled, let's try and connect. On the Mac Client, open a new Finder window and in the Shared list , select our other Mac. You'll notice that when we do, it just gives us a Connection Failed message.
The reason we're not able to connect is that we would need to log in with a username and password that is present on the Mac Server, just as though we were logging in physically at the Mac.
Click the Connect As... button and enter a username and password for a user account on the Mac Server. After doing so, you'll be able to access it.
Although we've enabled File Sharing, we've not specified any folders to share. By default, OS X will allow us to access the same folders that we would be able to if we were physically using it. In this instance, this is our home folder and the Applications folder.
Now we're connected, we can copy files to and from our Mac Server.
While we can certainly access our Mac Server if it was our user account we needed to access, we wouldn't necessarily want to give other people our Mac password just so they can copy files to and from it. What we need is a way of giving another user access to certain folders.
We can do this using something called Sharing Accounts. These are user accounts we can create on our Mac that exist only for the purpose of remote access. They cannot log in, in fact they don't appear in the login screen at all.
In System Preferences on the Mac Server, open the Accounts preference pane. You can see the list of current user accounts in the column on the left. At the bottom, click on the + button to add a new account.
We're going to add a new Sharing Only account. Change the account type accordingly and then specify a user name and password. Here I've set up a new sharing account for Jack.
Jack's account isn't given a home folder and cannot log in like a regular user. All it can do is be used with certain sharing services, such as file sharing.
Head back to the Sharing preference pane and make sure to select the File Sharing service.
Under the Shared Folders column, click the + button and designate your Downloads folder as a new shared folder.
As you can see, OS X maintains the default permissions for this folder and is only allowing me to access it.
Now, click the + button under the Users column and select our new user, in this case it's Jack. Jack is immediately given read access to our Downloads folder.
We can change this to read and write by selecting it and changing it accordingly.
Now that we've completed setting up our restricted access, let's try and log in as Jack.
On the Mac Client, select the Mac Server in the Finder again and then click Connect As…. Log in with Jack's new username and password and you should then see that we can access only the Downloads folder. We're also able to copy files to and from it with full access to any existing files within.
The benefit of OS X's File Sharing service over AirDrop is that you can delegate access to different people with different privileges for different folders. In fact, File Sharing in OS X Mountain Lion is pretty powerful and you could add sharing accounts for many different people and delegate access accordingly.
Additionally, File Sharing is constantly running in the background so you don't need to actively select any menus or messages. It's even running when all the users are logged out so even if you're away from your Mac, other users with appropriate access can still copy files to and from it.
If you're needing to regularly share files across a network with a small number of people then using OS X's File Sharing may be the solution you need. You don't need to invest in any expensive file servers and, especially with Mountain Lion, it's incredibly easy to set up and configure.