OK, so if you’re like me your a bit of an all rounder, you will almost certainly come up against a MAC in your travels! While I used to cringe when I got the “ohh while you are here, the designers MAC has been playing up” line, now I am joyed by this as it tends to give a challenge! And for those of us who have embraced the world of MAC OSX we realise that its not all bad…
So in this little post I’ll be demonstrating how to use Terminal to mount an SMB (windows share) to a folder. Firstly there is the basic method of “Connect to Server” from the Finder >> Go >> Connect to Server option, see image left.. While I regularly use this method it simply mounts the share as a browse-able network share failing to actually “mount” it to a folder on your Mac drive. To briefly cover this Connect to Server option, simply select the connect to server option then type in smb://serveraddress/share and hit connect, its that simple.
My Mount option is a little more tricky however it enables the ability to say use a SMB share for all of your iTunes music, or work from a SMB/Windows share. Of great benefit is utilizing this as a logon script to enable a user in a predominantly Windows environment to have an equivalent to “mapped network drives” on their mac.
- Open up Terminal and mount mount mount!
Head to Applications >> Utilities >> Terminal and follow the below sample to create a folder to mount to in your home directory and to mount your share to said folder. Note you can create the folder wherever you want.
The below will mount your smb share to the folder we just created!
mount_smbfs //username:password@serverip/share ./sharemount
Ensure that the user account you will use to access this share has the correct permissions on the share and the folder (inherited down) on the windows server or you will mount but have issues accessing files.
Unfortunately this method will only mount for the session and a restart will require the command to be run again (not the mkdir bit! just the mount_smbfs bit) I find the best way is to create a script and then have it launch when the user logs in.
NOTES: I’ve noticed some occasions where windows server might have restarted or the MAC went to sleep and didn’t re establish correctly, for this I usually simply eject the server in Finder by clicking the little eject button to the right of the server in finder and then run the script again to reconnect the shares. Perhaps even leave a copy of the connect script you create on the desktop so the user can re establish before calling support!
Leave questions in the comments, thanks!