Skip to content

Instantly share code, notes, and snippets.

@josh23french
Last active December 17, 2015 17:18
Show Gist options
  • Save josh23french/5644589 to your computer and use it in GitHub Desktop.
Save josh23french/5644589 to your computer and use it in GitHub Desktop.
Automount samba share in [Mountain] Lion.

Automounting setup

Make a new folder for your mount::

mkdir /Volumes/[folder name]

Open the master autofs file for editing::

sudo nano /etc/auto_master

Add the following line::

/- auto_smb

This tells autofs to look for /etc/auto_smb and use it's configuration. Now we'll edit that file and add our share::

sudo nano /etc/auto_smb

Add a line for your share::

/Volumes/[folder name] -fstype=smbfs,soft ://[user]:[pass]@[server]/[share]

The [folder name] should probably be the same as [share]. The [pass] should be url-encoded if it contains special characters.

For security reasons, only root should be able to read /etc/auto_smb, so::

sudo chmod 600 /etc/auto_smb

Linking to desktop

You can choose where to put a link, but the desktop makes sense for most people::

ln -s /Volumes/[folder name] ~/Desktop/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment