Auto mount network share

GIZBUG

macrumors 68020
Original poster
Oct 28, 2006
2,131
1,114
Chicago, IL
How do i automount a network share? I don't want finder popping up every time i reboot my iMac.

Suggestions?
 

KALLT

macrumors 603
Sep 23, 2008
5,136
3,182
You could create a workflow with Automator. Just create an application with it, add ‘Get Specified Servers’ and ‘Connect to Servers’ to the area and add the URLs of your network shares. If authentication is required, you could add this to the URLs. Afterwards you just put the application somewhere safe and add it as a login item in System Preferences.
 
Last edited:
  • Like
Reactions: simon lefisch

HenryAZ

macrumors 6502a
Jan 9, 2010
632
113
South Congress AZ
How do i automount a network share? I don't want finder popping up every time i reboot my iMac.

Suggestions?
Mount the share. Open System Preferences/Users & Groups, go to your user's "Login Items", and drag the share from the Finder sidebar to your Login Items.
 

VictoryHighway

macrumors member
Jun 22, 2008
86
51
Hopedale, MA
Mount the share. Open System Preferences/Users & Groups, go to your user's "Login Items", and drag the share from the Finder sidebar to your Login Items.
Yes, but doing that always pops up a finder window for each share at startup, even if you click the hide option. This worked correctly in one point update a long time ago (10.5.8 I think), but has been broken ever since the following point update.
 

VictoryHighway

macrumors member
Jun 22, 2008
86
51
Hopedale, MA
If you find an answer- please post it. I've been looking for a way to do that since I switched to Macs back in 2007.
I just use an AppleScript, that I compile into an Application, and then launch that from the "login items." This is the script:

Code:
-- Define username
property username : "yourusername"

-- Define shares
property mapdrive1 : "smb://" & username & "@yourserver/Share1"
property mapdrive2 : "smb://" & username & "@yourserver/Share2"
property mapdrive3 : "smb://" & username & "@yourserver/Share3"

-- Mount Volumes
mount volume mapdrive1
mount volume mapdrive2
mount volume mapdrive3
Replace SMB with AFP or NFS if you're using either of those protocols.
 

steve23094

macrumors 68030
Apr 23, 2013
2,709
1,489
I just use an AppleScript, that I compile into an Application, and then launch that from the "login items." This is the script:

Code:
-- Define username
property username : "yourusername"

-- Define shares
property mapdrive1 : "smb://" & username & "@yourserver/Share1"
property mapdrive2 : "smb://" & username & "@yourserver/Share2"
property mapdrive3 : "smb://" & username & "@yourserver/Share3"

-- Mount Volumes
mount volume mapdrive1
mount volume mapdrive2
mount volume mapdrive3
Replace SMB with AFP or NFS if you're using either of those protocols.
I have tried this and it looks like it works well.

When I run the script the dialog box pops up requesting the network drive user password. I have the password saved in my Keychain so all I have to do is press Connect. But is there a way to automatically parse the password through so that's not necessary? I presume it would be a weakness in security because somebody could see the password in my script, but I figure if somebody has access to my Mac's user account I have bigger problems than a visible home network drive password.

EDIT: I think I know what to do, I'm just not sure where to put the quotation marks. I think I want it to look like this:-
Code:
smb://username:password@servername/sharename
I have:-

Code:
-- Define username
property username : "yourusername"
property password : "yourpassword"

-- Define shares
property mapdrive1 : "smb://" & username & ":" & yourpassword & "@yourserver/Share1"

-- Mount Volumes
mount volume mapdrive1
EDIT2: But that definitely doesn't work, error message is There was a problem connecting to the server "yourusername"
 
Last edited:

steve23094

macrumors 68030
Apr 23, 2013
2,709
1,489
Keep us informed if you get it working....I've been looking for something like this for years
Check out the ControlPlane app (http://www.controlplaneapp.com), it's pretty good. It won't solve pressing Connect but you might find it very useful to trigger automatic mounts (and lots of other stuff besides). I read about it in another thread when I was trying to find a solution to this problem.
 

steve23094

macrumors 68030
Apr 23, 2013
2,709
1,489
Looks interesting but I wonder if it'll be compatible with Sierra
Yes, it definitely is. I'm using it now with Sierra to auto mount my network drives (I still have to press Connect though) and run my VPN app. I have set both up only to process when I have my WiFi link up. Sometimes it takes a while for my WiFi to connect after boot and other methods to achieve these two things end up timing out.

I'll probably figure out other cool things to do with it, I only started using it earlier today.
 

fhall1

macrumors 68040
Dec 18, 2007
3,504
738
(Central) NY State of mind
Well...if you still need to hit "connect", I might as well stick with my method of putting the mounts into my login items. I have to close the folder window that pops up when they're mounted, but it's either a click on the close button, or a click on the "connect" button. Still no ideal solution.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.