Mac OS X Server

Mac OS X Server: Sharing Files 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 <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