Sharing a folder with the terminal
Take a look at this article by Mike Barron, NetBoot Part 4.

In the article Mike walks through the dscl commands he used to share folders on Mac OS X for the Apple Filing Protocol (AFP) and Server Message Block (SMB) protocols:


  The toughest one so far has been file sharing. In our lab we share all our Work partitions to the entire internal network over AFP and SMB. In the past we used SharePoints to modify the NetInfo database to do so, but this functionality has all been moved over to Directory Services. To complicate matters, SAMBA no longer relies simply on standard SMB configuration files in standard locations, and the starting and stopping of the SMB daemon is handled completely by launchd. So figuring this all out has been a headache. But I think I’ve got it!