Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Apple > Operating Systems

  • Print
  • + Share This
This chapter is from the book

Using Apple Filing Protocol

Apple Filing Protocol (AFP) has been the default file-sharing protocol for Mac OS X and its predecessors for quite some time. As Apple moves forward with an ever-widening set of options when dealing with permissions, it is important to understand the basics of POSIX permissions and their role in Mac OS X and Mac OS X Server.

Understanding POSIX Permissions with AFP Share Points

When you share files over AFP, you should understand the POSIX permissions model. In the POSIX permissions model, permissions depend on whether an item is new or a copy of an existing item.

Here’s the easy part: When you copy an item within a single volume, that item always retains its original ownership and permissions. In contrast, when you create a new item on a mounted volume, or copy an item from one volume to another volume, Mac OS X and Mac OS X Server use the following rules for ownership and permissions for the new file or folder:

  • The owner of the new item is the user who created or copied the item.
  • The group is the group associated with the enclosing folder; in other words, the newly copied item inherits its group from the enclosing folder.
  • The owner is assigned read and write permissions.
  • The group is assigned read-only permissions.
  • “Others” is assigned read-only permissions.

The variable that controls the permissions for newly created files is called the umask (changing the umask from the default of 022 is outside the scope of this book). Under this model, if you create an item in a folder in which the group has read/write permission, the item will not inherit that permission. If you want to let other group members edit the new item, you must change its permissions manually, using the Finder’s Get Info command, or using chmod in the command line. This is one reason you may decide to use ACLs.

Setting Access to Share Points and Folders

Once you’ve created a share point and determined the protocols you will use, you can begin to address levels of access within that share point. You need to consider POSIX privileges (ownership and permissions) as well as file-system access permissions (set via ACLs), both of which were discussed in Chapter 2, “Authenticating and Authorizing Accounts.” Using this very flexible system, you can apply access settings to any folder within your share points through inheritance or explicit support.

To configure access settings for share points or folders, use the Permissions pane when viewing that share point or folder in Server Admin. The standard POSIX settings are listed as Owner, Group, and Others in the bottom half of the pane; access settings using ACLs are set in the top half. You can use Server Admin to create and edit an ACL for a folder, but not for a file. Remember that POSIX privileges always exist for every file and every folder.

To see the result of access-control settings, you can use the Effective Permission Inspector, available from the Action pop-up menu (labeled with a gear and a down arrow) in the lower-left corner of the Permissions pane.

Enabling Service Access with Server Preferences

You can use Server Preferences to quickly enable the default file-service protocols and share points. If you enable file sharing during your initial server setup, regardless of how you choose to manage your users and groups, your server will automatically offer AFP and SMB services, with a set of preconfigured share points. Here is a list of the share points and the paths to the share points:

  • Users (/Users)
  • Groups (/Groups)
  • Public (/Shared Items/Public)

You can easily add another share point, remove a share point, and edit basic access to the share point for network user accounts with Server Preferences.

Removing and Adding Share Points with Server Preferences

It is easy to remove or add a share point with Server Preferences, but Server Preferences doesn’t let you create a folder. If you want to create a new folder to use for a share point, you must first use the Finder, Server Admin, or command-line tools to create a folder on your server.

To keep the example simple, rather than create another folder to share, you will use Server Preferences to remove the Public share point, then add the Public share point again.

  1. On your Mac OS X computer, open Server Preferences and authenticate to your server with Local Administrator credentials.
  2. Click File Sharing.
  3. Select the Public share point.
  4. Click the Remove (–) button and verify that you want to remove the share point.

    You have just removed the Public share point. It is no longer accessible over AFP or SMB file sharing.

  5. Add Public as a share point again.

    Click the Add (+) button.

  6. Navigate to /Shared Items/Public on your boot disk, then click Share.

    Note that this enables the share point for both AFP and SMB access.

Editing Share Point Permissions with Server Preferences

You can adjust basic access to your share point with Server Preferences.

You have the choice of allowing read and write access to the share point for all users, or specifying a limited list of network user and group accounts. You can also enable or disable guests to have read-only access. Keep in mind that this enables and disables guest access for both AFP and SMB.

If you click Edit Permissions for a share point, you will see the following pane, which displays only network users and groups. When you select “Allow read and write access for,” “Only these registered users and groups,” this adds an allow ACE for the users you select, followed by a deny ACE for the group named Workgroup (all network users), to the ACL of the folder.

Note that there is a checkbox labeled “Allow guests read-only access.” This checkbox affects both AFP and SMB services, so when you use Server Preferences to enable guest access for AFP, you also enable guest access for SMB.

Because Server Admin gives you much more flexibility in creating and enabling file-sharing services, the rest of this chapter focuses on using Server Admin.

Creating and Enabling Service Access with Server Admin

Server Admin offers you more options in configuring file-sharing services than Server Preferences.

The General and Access settings you configure for each service in Server Admin are part of the basic configuration steps you need to take regardless of which sharing protocols you decide to use. However, a few additional configuration settings are available for each share point from the pop-up menu in the Protocol Options pane in Server Admin. Here is the General pane under Settings for the AFP Service.

The Login Greeting field lets you specify a message to be displayed when a user connects. The message appears even when a user connects to his or her home folder.

When you enable the AFP service, users of Mac OS X computers will see your server’s Computer name (as defined in the Sharing preference) in the Finder sidebar by default. Here is Server 17’s Sharing preference:

Here’s what the Finder looks like for a Mac OS X computer on the same network as the Mac OS X Server with the AFP service enabled.

Controlling Access

AFP gives you the option to use either Kerberos or standard authentication as a method of authenticating users. If you choose Any Method in the Authentication pop-up menu, AFP will first try to authenticate using Kerberos; if the connection cannot be established using Kerberos, it will use standard authentication.

Once the user is authenticated, file permissions control access to the files and folders on your server. One setting should be called out with respect to permissions: the Others permissions. When you set Others permissions, those permissions apply to everyone who can see the item (either a file or folder) who is neither the owner nor part of the default group. You need to understand how Others permissions combine with another feature, guest access. As the name implies, guest access lets anyone who can connect to your server use its share points. A user who connects as Guest is given Others permissions for file and folder access. If you give read-only access to Others on a share point that allows guest access, everyone on your network (and possibly the entire Internet) can see and mount that share point.

If a folder is buried deep within a file hierarchy where guests can’t go (because the enclosing folders don’t grant access to Others), then guests can’t use the Finder to browse to that folder. The Others permissions apply only to users who have been granted permission to see the enclosing folders but have not been granted permission to see that folder via their user and group settings.

Guest access can be very useful, but before you enable it, be sure you understand its implications in your permissions scheme.

Enabling Access

File ACLs control file-system access. Service ACLs (SACLs) control which service a user can access and provide an extra level of control when configuring your server. You can set SACLs per service or globally for the entire server. It is important to understand the ramifications when enabling SACLs across all services. Therefore, as a cautionary measure, it is best to enable SACLs per service to reduce the amount of confusion for your users.

Logging Activity

Are you concerned that a user is accessing items that he or she should not have access to? Are you getting complaints from your users that their documents are disappearing or that they can’t access things they should have access to? For troubleshooting these issues and more, logging is an invaluable resource.

AFP can keep two types of logs: the error log, which is always open by default, and the access log, which you must enable on the server using Server Admin (also used to view the logs). Enable the access log only when needed. Every action taken by a user is logged to this file, so it can become large very quickly and fill the available space in the file system. Logging all of these events for a busy server with a couple of hundred users can quickly result in a large log file that will be difficult to read through when attempting to diagnose the source of the issue. Alternately, you can configure the logging settings to save only certain events to the log, including Login, Logout, Open File, Create File, Create Folder, and Delete File/Folder. Another disk space–saving feature available to you is log archival. This will save (and compress) each log file after the specified period of time.

Troubleshooting and Monitoring Usage

In addition to the logs, Server Admin gives you graphical information about the current state of your server. You can view the number of connections, which users are currently connected, what protocol they used to connect, and how long they have been connected. In addition, the Graphs pane gives you a historical view of the amount of overall activity that the server has seen recently.

Monitoring server usage is a valuable tool to keep track of workflow. You can view graphs and watch for usual traffic patterns, usage spikes, and low-usage periods that you could use to plan backups or perform server maintenance.

  • + Share This
  • 🔖 Save To Your Account