Create Windows shares for non-home directories

Aug 26, '02 01:17:06AM

Contributed by: robg

One of the (very) nice features in Jaguar is the bundled Samba server, which allows your Mac to be visible to Windows computers. All you need to do is enable the setting for "Windows File Sharing" on the Services tab of the Sharing preferences panel (and make sure the user is allowed to connect from Windows boxes in the Accounts preferences panel). After that, each user can access his or her home folder from any Windows machine on the network.

While this is a great advance over the need to install and configure Samba, the downside is that only your home directory is shared. I needed to do more than this, as we keep our digitized CD collection on another hard drive and serve it up to a Turtle Beach Audiotron in the living room (see this hint for the details). So to get the Audiotron working, I needed a way to establish a Samba share for my iTunes hard drive.

After "phoning a friend," he pointed me to the smb.conf file located in /etc. I then spent a bit of time reading the extensive (over 100 pages!) man pages for smb.conf, and tried and failed a few (too many?) times before successfully creating my new share ... but in the end, I triumphed over the command line!

Read the rest of the article for a (very very light, for that's all I know!) introduction to creating additional Samba shares in Jaguar.

After reading a few pages of the manual, I got brave and decided to experiment. I started by creating a backup of the smb.conf file (sudo cp /etc/smb.conf /etc/smb.conf.bak). The basic structure of the smb.conf file isn't too hard to understand. The basic format is:

[name of share]
setting #1
setting #2
...

[name of next share]
etc
The trick is figuring out which settings to use, and what values to set them to. I am not promising that the following is the most correct, the most secure, or even good ... all I'm promising is that this worked for me and made my external hard drive visible to my Windows box (and the Audiotron, of course). I created a new share by editing (as root) the smb.conf file and adding these lines:
[music]
comment = iTunes files
path = /Volumes/myMusic/digitunes
browseable = yes
read only = no
create mode = 0750
I won't try to explain all the settings, but the important ones are the name of the share (the first line, in brackets), the path to the folder, and the "browseable = yes", which makes the share visible in the Network Neighborhood. I then used the GUI to disable and restart Windows file sharing, and then used this command to check the status of the shares:
 % smbutil view //localhost
After entering my admin password, the output is:
Share        Type       Comment
-------------------------------
music disk iTunes files
IPC$ pipe IPC Service (Samba 2.2.3a)
ADMIN$ disk IPC Service (Samba 2.2.3a)
robg disk User Home Directories
Notice that the "comment" line I created appears in the status report. Once I saw the share here, I switched over to my Windows box and was able to connect and browse without any problems.

Although this is a super-light introduction to editing the smb.conf file, perhaps its enough to save someone the 30 to 45 minutes I spent fighting the file tonight ;-).

Comments (33)


Mac OS X Hints
http://hints.macworld.com/article.php?story=2002082601170699