Manage File Services In OS X Server 5

File Services are perhaps the most important aspect of any server because file servers are often the first server an organization purchases. This has been changing over the past few years, with many a file being hosted by cloud solutions, such as Box, Dropbox, Google Drive, and of course, iCloud. But many still need a terrestrial server and for predominantly Apple environments, a Server app running on OS X El Capitan isn’t exactly a bad idea. There are a number of protocols built into OS X Server dedicated to serving files, including AFP, SMB and WebDAV. These services, combined comprise the File Sharing service in OS X Server running El Capitan or Yosemite. Note: I’ve got another article looking into FTP a little further but those are basically the services that I’ll stick to here. File servers have shares. In OS X Server, Server app 5 (for Yosemite and El Capitan), we refer to these as Share Points. The first step to setting up a file share is to create all of your users and groups (or at least the ones that will get permissions to the shares). This is done in Server app using the Users and Groups entries in the List Pane. Once users and groups are created, open the Server app and then click on the File Sharing service in the SERVICES list in the List Pane. Here, you will see a list of the shares on the server. Screen Shot 2015-09-07 at 10.22.02 PM If you’re just getting started, let’s go ahead and disable any built-in shares by clicking on the share and then clicking on the minus button (-) while the share is highlighted. When prompted to remove the share, click on the Remove button. Screen Shot 2015-09-07 at 10.23.01 PM As mentioned, shares can be shared out using different protocols. Next, we’re going to disable SMB for Public, simply as an example. To do so, double-click on Public and then uncheck the SMB protocol checkbox for the share. Screen Shot 2015-09-07 at 10.24.10 PM When you’ve disabled SMB for the last share, you’ve effectively disabled SMB. Click on the Done button to save the changes to the server. Editing shares is really that easy. Next, we’re going to create a new share for iPads to be able to put their work, above and beyond the WebDAV instance automatically used by the Wiki service. To create the share, first we’re going to create a directory for the share to live in on the computer, in this case in the /Shared Items/iPads directory. Screen Shot 2015-09-07 at 10.37.40 PM Then from the File Sharing pane in Server app, click on the plus sign (“+”). Screen Shot 2015-09-07 at 10.38.28 PM At the browse dialog, browse to the location of your iPad directory and then click on the Choose button. Screen Shot 2015-09-07 at 10.40.16 PM At the File Sharing pane, double-click on the new iPads share. Note that there’s a new checkbox here called “Allow only encrypt connections”. If you check this, you cannot use AFP and WebDAV. Screen Shot 2015-09-07 at 10.40.38 PM At the screen for the iPads share, feel free to edit the name of the share (how it appears to users) as it by default uses the name of the directory for the name of the share. Then, it’s time to configure who has access to what on the share. Here, use the plus sign (“+”) in the Access section of the pane to add groups that should be able to have permission to access the share. Also, change the groups in the list that should have access by double-clicking on the name of the group and providing a new group name or clicking on the plus sign to add a user or group. Screen Shot 2015-09-07 at 10.41.27 PM The permissions available in this screen for users that are added are Read & Write, Read Only/Read and Write. POSIX permissions (the bottom three entries) also have the option for No Access, but ACLs (the top entries comprise an Access Control List) don’t need such an option as if there is no ACE (Access Control Entry) for the object then No Access is assumed. If more granular permissions are required then click on the name of the server in the Server app (the top item in the List Pane) and click on the Storage tab. Here, browse to the directory and click on Edit Permissions. Screen Shot 2015-09-07 at 10.42.14 PM As can be seen, there are a number of other options that more granularly allow you to control permissions to files and directories in this view. If you make a share a home folder, you can use that share to store a home folder for a user account provided the server uses Open Directory. Once a share has been made an option for home folders it appears in both Workgroup Manager and the Server app as an available Home Folder location for users in that directory service. Once you have created all the appropriate shares, deleted all the shares you no longer need and configured the appropriate permissions for the share, click on the ON button to start the File Sharing service. Screen Shot 2015-09-07 at 10.42.41 PM 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 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. The File Sharing service can also be controlled from the command line. Mac OS X Server provides the sharing command. You can 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 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 You can also use the serveradmin command to manage file shares as well as the sharing service. To see settings for file shares, use the serveradmin command along with the settings option and then define the sharing service: sudo serveradmin settings sharing Sharing settings include the following: sharing:sharePointList:_array_id:/Shared Items/iPads:dsAttrTypeStandard\:GeneratedUID = “54428C28-793F-4F5B-B070-31630FE045AD” sharing:sharePointList:_array_id:/Shared Items/iPads:smbName = “iPads” sharing:sharePointList:_array_id:/Shared Items/iPads:afpIsGuestAccessEnabled = no sharing:sharePointList:_array_id:/Shared Items/iPads:webDAVName = “iPads” sharing:sharePointList:_array_id:/Shared Items/iPads:smbDirectoryMask = “0755” sharing:sharePointList:_array_id:/Shared Items/iPads:afpName = “iPads” sharing:sharePointList:_array_id:/Shared Items/iPads:smbCreateMask = “0644” sharing:sharePointList:_array_id:/Shared Items/iPads:nfsExportRecord = _empty_array sharing:sharePointList:_array_id:/Shared Items/iPads:path = “/Shared Items/iPads” sharing:sharePointList:_array_id:/Shared Items/iPads:smbUseStrictLocking = yes sharing:sharePointList:_array_id:/Shared Items/iPads:smbIsGuestAccessEnabled = no sharing:sharePointList:_array_id:/Shared Items/iPads:name = “iPads” sharing:sharePointList:_array_id:/Shared Items/iPads:smbInheritPermissions = yes sharing:sharePointList:_array_id:/Shared Items/iPads:ftpName = “iPads” sharing:sharePointList:_array_id:/Shared Items/iPads:serverDocsIsShared = yes sharing:sharePointList:_array_id:/Shared Items/iPads:smbIsShared = yes sharing:sharePointList:_array_id:/Shared Items/iPads:afpIsShared = yes sharing:sharePointList:_array_id:/Shared Items/iPads:smbUseOplocks = yes sharing:sharePointList:_array_id:/Shared Items/iPads:webDAVIsShared = yes sharing:sharePointList:_array_id:/Shared Items/iPads:dsAttrTypeNative\:sharepoint_group_id = “3A1C9DAD-806C-4917-A39F-9317B6F85CCD” sharing:sharePointList:_array_id:/Shared Items/iPads:mountedOnPath = “/” sharing:sharePointList:_array_id:/Shared Items/iPads:isIndexingEnabled = yes sharing:sharePointList:_array_id:/Shares/Public:ftpIsShared = yes sharing:sharePointList:_array_id:/Shares/Public:smbName = “Public-1” sharing:sharePointList:_array_id:/Shares/Public:nfsExportRecord = _empty_array sharing:sharePointList:_array_id:/Shares/Public:afpIsGuestAccessEnabled = no sharing:sharePointList:_array_id:/Shares/Public:isIndexingEnabled = no sharing:sharePointList:_array_id:/Shares/Public:dsAttrTypeStandard\:GeneratedUID = “80197252-1BC6-4391-AB00-C00EE64FD4F2” sharing:sharePointList:_array_id:/Shares/Public:path = “/Shares/Public” sharing:sharePointList:_array_id:/Shares/Public:smbIsShared = yes sharing:sharePointList:_array_id:/Shares/Public:afpUseParentOwner = no sharing:sharePointList:_array_id:/Shares/Public:afpName = “Public-1” sharing:sharePointList:_array_id:/Shares/Public:smbIsGuestAccessEnabled = no sharing:sharePointList:_array_id:/Shares/Public:ftpIsGuestAccessEnabled = no sharing:sharePointList:_array_id:/Shares/Public:afpUseParentPrivs = no sharing:sharePointList:_array_id:/Shares/Public:afpIsShared = yes sharing:sharePointList:_array_id:/Shares/Public:name = “Public-1” sharing:sharePointList:_array_id:/Shares/Public:ftpName = “Public-1” sharing:sharePointList:_array_id:/Users/krypted/Public:dsAttrTypeStandard\:GeneratedUID = “0D6AF0D1-BA70-4DD4-9256-AC1B51A2761F” sharing:sharePointList:_array_id:/Users/krypted/Public:smbName = “Public” sharing:sharePointList:_array_id:/Users/krypted/Public:afpIsGuestAccessEnabled = no sharing:sharePointList:_array_id:/Users/krypted/Public:webDAVName = “Public” sharing:sharePointList:_array_id:/Users/krypted/Public:smbDirectoryMask = “0755” sharing:sharePointList:_array_id:/Users/krypted/Public:afpName = “Public” sharing:sharePointList:_array_id:/Users/krypted/Public:smbCreateMask = “0644” sharing:sharePointList:_array_id:/Users/krypted/Public:nfsExportRecord = _empty_array sharing:sharePointList:_array_id:/Users/krypted/Public:path = “/Users/krypted/Public” sharing:sharePointList:_array_id:/Users/krypted/Public:smbUseStrictLocking = yes sharing:sharePointList:_array_id:/Users/krypted/Public:smbIsGuestAccessEnabled = no sharing:sharePointList:_array_id:/Users/krypted/Public:name = “Public” sharing:sharePointList:_array_id:/Users/krypted/Public:smbInheritPermissions = yes sharing:sharePointList:_array_id:/Users/krypted/Public:ftpName = “Public” sharing:sharePointList:_array_id:/Users/krypted/Public:serverDocsIsShared = yes sharing:sharePointList:_array_id:/Users/krypted/Public:smbIsShared = no sharing:sharePointList:_array_id:/Users/krypted/Public:afpIsShared = yes sharing:sharePointList:_array_id:/Users/krypted/Public:smbUseOplocks = yes sharing:sharePointList:_array_id:/Users/krypted/Public:dsAttrTypeNative\:sharepoint_group_id = “FF1970EF-0789-49C7-80B5-E9FCABDDBB49” sharing:sharePointList:_array_id:/Users/krypted/Public:isIndexingEnabled = yes sharing:sharePointList:_array_id:/Users/krypted/Public:mountedOnPath = “/” To see settings for the services use the serveradmin command with the settings option followed by the services: afp and smb: sudo serveradmin settings afp AFP settings include: afp:maxConnections = -1 afp:kerberosPrincipal = “afpserver/LKDC:SHA1.66D68615726DE922C1D1760BD2DD45B37E73ADD4@LKDC:SHA1.66D68615726DE922C1D1760BD2DD45B37E73ADD4” afp:fullServerMode = yes afp:allowSendMessage = yes afp:maxGuests = -1 afp:activityLog = yes