Understanding Personal File Sharing


Personal File Sharing uses AFP. The process that provides AFP service is AppleFileServer. The executable file resides in /System/Library/CoreServices/AppleFileServer.app/Contents/MacOS/, but you normally invoke it from a symbolic link, /usr/sbin/AppleFileServer. You start and stop AFP service from the Sharing pane of System Preferences. You can also start or stop service from the command line by starting the process directory.

There are system plist files in /System/Library/CoreServices/AppleFileServer.app/Contents that also control AFP, but you shouldn't touch those.

Two configuration files control AppleFileServer: /etc/hostconfig and /Library/Preferences/com.apple.AppleFileServer.plist. In addition, a property in com.apple.sharing.firewall.plist controls whether the AFP port in the firewall is open. You can use Property List Editor to edit the two plist files. You can also edit these files with a text editor, but first you must convert them from binary to text XML format:

sudo plutil convert xml1 /Library/Preferences/com.apple.AppleFileServer.plist


The system log, /var/log/system.log, contains entries for AFP startup and for abnormal shutdown. An error log and an access log also reside in /Library/Logs/AppleFileService.

Starting the Apple File Service

Starting Apple File Service consists of a series of steps:


  1. You start Personal File Sharing in the Sharing pane of System Preferences.

  1. The enable property for Personal File Sharing in /Library/Preferences/com.apple.sharing.firewall.plist changes from 0 to 1. This change opens a port in your computer's firewall for AFP connections.

    When AppleFileServer terminates, it writes the integer value serverStoppedTime to /Library/Preferences/com.apple.ServerAdmin.plist.

  1. A line in the /etc/hostconfig file changes from AFPSERVER= NO to AFPSERVER=YES. When you restart your computer, the startup script /System/Library/StartupItems/AppleShare/AppleShare starts AppleFileServer if the value in /etc/hostconfig is YES.

  1. The AppleFileServer process handles communication with other computers over AFP.

When you stop Personal File Sharing in the Sharing pane of System Preferences, the steps are reversed. That is, the configuration files are changed back and the AppleFileServer process quits.

As an alternative to using Sharing preferences, you can enable AFP service by performing these tasks, as root:

1.

Edit com.apple.sharing.firewall.plist, using Property List Editor or a text editor (if using a text editor, you must use plutil first), and change the enable property under Personal File Sharing from 0 to 1.

2.

Execute the program /usr/sbin/AppleFileServer.

3.

Edit /etc/hostconfig to AFPSERVER=YES from AFPSERVER=NO.

To stop AFP service, you would reverse these steps, changing the file settings and killing the process.

Editing com.apple.AppleFileServer.plist

No graphical user interface exists that is specifically designed for modifying the behavior of AppleFileServer, but you can use Property List Editor or a text editor to edit the file com. apple.AppleFileServer.plist in /Library/Preferences.

Alternatively, you can use the defaults command. For example, to change the Boolean property admin31GetsSp from true to false, you would type the following:

sudo defaults write /Library/Preferences/com.apple.AppleFileServer admin31GetsSp -bool false

Note

Stop AppleFileServer before you make changes to its properties.


The following figure illustrates how changing items within the com.apple. AppleFileServer.plist affects users gaining access remotely.

Two properties that you might need to edit are:

  • admin31GetsSp: This property controls whether a user logging in as an administrator sees user share points or volumes. This field is set to TRue (yes) by default, so an administrator only sees share points. If you want administrators to see volumes, change the admin31GetsSp property to false (no).

  • guestAccess: This property controls whether users can log in as guest if they do not have an account on your machine. It is set to true by default. If you do not want to allow guest access, change the guestAccess property to false.




Apple Training Series. Mac OS X System Administration Reference, Volume 1
Apple Training Series: Mac OS X System Administration Reference, Volume 1
ISBN: 032136984X
EAN: 2147483647
Year: 2005
Pages: 258
Authors: Schoun Regan

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net