Setup the File Sharing Service in macOS 10.13, High Sierra

macOS Server 5.2/5.3 and below had this great file sharing service. And while the GUI elements are gone from the Server app in High Sierra, the options available in the client operating system have matured to the point where they’re no longer really necessary. You can still configure users and groups using the Server app, and once those are created, you’ll be ready to configure share points that can be accessed using the Sharing System Preferences.

Configure Sharing Through System Preferences
To access the sharing options, open System Preferences and click on File Sharing. First, we’ll configure the global options using the Options… button.

This brings up the ability to choose whether to share with AFP or SMB. Notice that FTP is gone and will need to be started from the command line. Check the box for each user that will be sharing files via Windows (unnecessary with OD-based users), and each protocol you’d like to share data as.

Next, we’ll configure share points. From the File Sharing entry in System Preferences, you’ll see a list of Shared Folders and Users. I like to remove everything the system adds by default. Then, use the + sign to add a add a new shared folder. 

Browse to the folder you’d like to share and then click on the Add button.

Once shared, configure the permissions of the folder. If you have the Server app, the best way to do this is to open the Server app, click on the name of the server, and then click on the Storage tab. From here, you can browse to a given share to configure ACLs.

From the cog wheel icon at the bottom of the screen, choose the Edit Permissions… button.

At the Edit Permissions screen, you can add additional users, and configure permissions more granularly than otherwise.

Once you make changes, you can use the same cog wheel icon to “Propagate Permissions.” Doing so will apply the same set of permissions on all child files. If you don’t have the server app, many of these same options will be available by doing a Get Info on a folder (which you can do with the Command-I keystroke, or with the File->Get Info menu item, within a standard Finder window.

Overall, there are fewer GUI options. And wwwwwaaaaaaayyyyyy fewer options, now that the serveradmin command line options are no longer available. But if there’s something you could do before that you can’t any more, let me know and I’ll add it (or a script to accomplish it) to this article.

Client Configuration
Once configured, you’ll want to connect to your server from a client. To connect to a share, use the Connect to Server dialog, available by clicking Connect to Server in the Go menu. A change that happened way, way back in Mavericks is that when you enter an address, the client connects over SMB by default (which is even better now that those connections can be encrypted). If you’d like to connect via AFP ‘cause you’re all old school, enter afp:// in front of the address and then click Connect.

Command Line Management
The File Sharing service can also be controlled from the command line. macOS also has the sharing command. Using this command you can programmatically inspect, create, delete and augment information for share points using sharing. 

To create a share point for AFP you can use the following command:

sharing -a <path> -A <share name>

So let’s say you have a directory at /Shares/Public and you want to create a share point called PUBLIC. You can use the following command:

sharing -a /Shares/Public -A PUBLIC

Now, the -a here will create the share for AFP but what if you want to create a share for other protocols? Well, -F does FTP (even though FTP is older than I am) and -S does SMB. Once created you can disable the share using the following command:

sharing -r PUBLIC

To then get a listing of shares you can use the following command:

sharing -l