Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Automatically mount SMB shares on login Network
To mount a SMB share with the Finder, the classical technique is to go to the Network directory, then to WORKGROUP, then to MACHINE, and then to choose a SHARE. But I want this to be done automatically when I log in. My technique is to run a shell script at login. Using 10.3.0 to 10.3.2, you can simulate the behaviour of the Finder by using this shell command:
cd /Network/WORKGROUP/MACHINE/SHARE
In 10.3.3, the previous cd trick is not working, but the following technique works (mostly):
mkdir '/Volumes/WORKGROUP;MACHINE'
mount_smbfs '//USER@MACHINE/SHARE' '/Volumes/WORKGROUP;MACHINE'
The above is shown as two unique commands; you could write it as a one-line script by separating the commands with a semicolon. One drawback of this mount_smbfs technique is that it does not perfectly simulate the behaviour of the Finder: you cannot eject the share with the Finder, you need to use the Terminal and do it this way:
umount '/Volumes/WORKGROUP;MACHINE'; rmdir '/Volumes/WORKGROUP;MACHINE'
[robg adds: I haven't tested this method. I connect to a number of SMB shares at work, but never logout of my laptop, so I just use a folder of aliases and click one when necessary.]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[36,030 views]  

Automatically mount SMB shares on login | 9 comments | Create New Account
Click here to return to the 'Automatically mount SMB shares on login' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Automatically mount SMB shares on login
Authored by: bluehz on May 10, '04 12:27:01PM

Dunno why people are always coming up with new ways to automount smb at startup. It doens't really get any more simple than mounting your smb once, then dragging the icon AT THE TOP OF THE MOUNTED DRIVES WINDOW into the Login Items PrefPane. It seems to require the icon at the top of the mounted drives icon as opposed to the icon off the desktop, etc. Seems like the only way that you can actually capture the login info so you don't have to enter it each time is using that icon.



[ Reply to This | # ]
Automatically mount SMB shares on login
Authored by: bluehz on May 10, '04 12:29:02PM

BTW - you can also drag that same icon into your Favorites dir and a single click on that will mount your smb. This is also true of WebDAV mounts. This too seems to require the same icon and only seems to work reliably when place in Favorites. Some odd interactions going on behind the scenes with authentication, but as long as it works I'm not worried about it.



[ Reply to This | # ]
Automatically mount SMB shares on use?
Authored by: bbeck13 on May 10, '04 12:59:31PM

Something I've always wanted to be able to do is to mount SMB shares on use. We had this cool automount setup on the BSD boxes at school such that when you changed into a directory it would mount a NFS share.

Does anyone know if this is possible to do with SMB under OS X. All of the documentation I've seen for automount on OS X seems to imply that it only works for NFS and not SMB. Anyone have success getting it to work with SMB?



[ Reply to This | # ]
Automatically mount SMB shares on login
Authored by: Anonymous on May 10, '04 11:28:43PM

You can also create a short cut/alias to a folder down in the SMB share and if you store your password in Keychain then it just takes to open that alias and the SMB share will mount. This will also work for NFS, and of course AFP. I have not tried FTP but I bet it too would work.

-S

---
~~~~~~~~~~~
Scott Stonefield
Sr. UNIX Systems Administrator
srs AT sas DOT com



[ Reply to This | # ]
Automatically mount SMB shares on login
Authored by: schneb on May 11, '04 10:52:41AM

Keychain has never EVER worked for me regarding SMB shares. It always demands that I login despite the hundreds of times I asked it to remember it.



[ Reply to This | # ]
The share does not use the same name
Authored by: Ptitboul on May 12, '04 05:34:45AM
At least under 10.3.3 (which is very different from previous versions of the OS) when using the Finder you get you share in /Volumes/WORKGROUP;MACHINE but using the preference pane it is mounted in /Volumes/machine.name.with.domain. Morevover, this mounts the share only when you login with the GUI.

[ Reply to This | # ]
Automatically mount SMB shares on login
Authored by: omnivector on May 11, '04 02:35:14AM

the correct way to do this is via the automount facilities in os x. this enables you to automatically mount shares on-demand, rather than on login. thus resources are not wasted when the shares aren't being used. the other advantage is this method doesn't produce the nasty can't-unmount-without-rebooting errors experienced in jaguar (although i think those in particular are fixed in panther). the last nice advantage is you can mount the partitions anywhere on the file system you please. aka, ~/Desktop, or /Volumes, or ~/Mounts (in my case). automount lets you automount nfs, smb, cifs, afp, webdav, ftp, or any other os x supported protocol. although only the ones with write support can write obviously (i.e. no write support for ftp via automount). if you want more info, check some of the other mac os x hints on this.

---
- Tristan



[ Reply to This | # ]
Manual mount vs. automount vs. startupitems
Authored by: Ptitboul on May 12, '04 05:25:08AM

I agree that it is yet another way to mount shares on login. But it has some advantages.

Automount needs administrator's rights to change the Netinfo database.

Startupitems works only when login with the GUI, not when login by ssh.



[ Reply to This | # ]
Automatically mount SMB shares on login
Authored by: xylo on Dec 10, '10 05:53:25AM

You can also use AutomountMaker

AutomounMaker is an easy to use GUI tool to create scripts that will mount an AFP, FTP, WebDAV(http), NFS or SMB network share You can use the script as a Startup Item in your user's session config to automatically mount the given share upon login (or even upon boot of the Mac). If you use always the same shared volume on your desktop, AutomountMaker is more easy than the classic Connect to Server... proposed by Apple.



[ Reply to This | # ]