Feb 05, '10 07:30:00AM • Contributed by: gordonlbuchanan
Here's a way of mounting Samba shares in Snow Leopard that does not depend on the login process. This method auto-mounts a share when it is accessed. You need to have an administrator password to edit and create the needed files.
First, edit /etc/auto_master (as root) and add a line:
/- auto_smbI use the free version of TextWrangler for this; it will prompt you for your admin password. This tells autofs to look in the file /etc/auto_smb for the mount info. The /- means the the full mount path will be specified in auto_smb.
Next, create a file called /etc/auto_smb which is owned by root:wheel. One way to do this is to type the following command in Terminal:
sudo touch /etc/auto_smbNow edit this new file to put the share info into it.
Each row you add has the following format. Note that there is a space between smbfs and the colon.
mountpath -fstype=smbfs ://user:password@server/sharedirectorymountpath is the path on the local file system where the share will be mounted. user:password is the username and password needed to access the Samba share. server is the Samba server name or address. sharedirectory is the directory on the Samba server that will be mounted. For example, I use these two lines:
/users/gordon/nas/family -fstype=smbfs ://gordon:XXXX@mynas/buchanan /users/marcy/nas/family -fstype=smbfs ://gordon:XXXX@mynas/buchananThis will create shares under the nas directory in the home directories for users gordon and marcy. The nas directories must be manually created by you; the automount process will automatically create the family directory.
To tell the system to use the new automount info, you can reboot. It should also be possible to run the following command, but I've found that it doesn't always work correctly.
sudo automount -vcTo access the share, just go to the mountpath; in my example, that's the directory /users/gordon/nas/family. The share will automatically be mounted.
This works great with iTunes. I have my library stored on the Samba server, and when I open iTunes, the share is automatically mounted and my music is available. For me, this works much better than what I had previously set up, which was mounting the server via a login process. Sometimes my share would get disconnected, for whatever reason, and then when I launched iTunes, I would get the message that the music library could not be found.
