Automatically mount network shares

Hi all,

I'm a relative newbie to Mac OS X, having only just recently replaced all my PCs at home with Mac computers. Overall I'm enjoying the switch, but there's still one thing that I really miss from Windows: Mounted Network Drives.

Windows recap: You can "mount" a "network drive", providing a user name & password if necessary, to a network share, and it will always automatically mount at startup. (Actually, I think it only tries to make the connection the first time anything, including your software, tries to access the path.)

I have a NAS with several shares that I use for almost everything, so a lot of my applications need those shares to be mounted. I have some applications which are set to open at login, but they give me errors because the share they need is not mounted. If I go to Finder and click on the shares, they mount (most of the time, anyway... that's another story), and then the applications work.

I've searched around looking for the ah-hah! solution, and the closest I've come is a lot of talk about automount, autofs, fstab, dscl... but most of the discussions assume some previous knowledge of what these things do and how to use them.

I've also tried the oft-suggested method of dragging mounts into the login items in System Preferences > Users, but that is a weak solution because (a) it opens a Finder window for each share at login (very annoying), and (b) it doesn't happen early enough so some of my start-up applications still can't see the share when they need it.

Has anyone else who has switched from Windows found a good solution that gets something close to the "network drive" concept? Can someone explain in plain English how to use autofs (and whether that is a good solution or not)?

Any help greatly appreciated.

Will.

Mac Pro, MacBook, Mac Mini x 2, iPod nano, Mac OS X (10.5.1), NAS: Thecus N5200

Posted on Nov 17, 2007 2:06 AM

Reply
7 replies

Nov 17, 2007 2:12 AM in response to bdinmstig

This is really easy in OS X.

First, mount the network drives, enter the user name and password, and make sure to select "add password to keychain" so that you don't have to type it in each time.

Your network drives should mount on your desktop (I don't know if they show up on the desktop under leopard, if they don't navigate to the top level folder of your computer in the finder which will list your harddrives and network drives) Now, open System Preferences and click on Accounts. Click on the user you want to automount the drives for. Click on "Login Items." Now, the magic, just drag the network drive from your desktop of the finder window into the login items window.

That's it.

Dec 3, 2007 3:10 AM in response to bdinmstig

Will,

Not what you want, but maybe a workaround. I too need to mount shares on startup, and need these mounted before some of my apps. open. I put the shares in the login items and took the apps. out of login. For each app. I then made an Automator action to start the app. after so many seconds (can be a big number giving system plenty of time to start up and mount shares) and then put these automator items in the login pane. Now the apps only open after the shares are mounted.

David

Dec 3, 2007 3:15 AM in response to bdinmstig

bdinmstig wrote:
Hi all,


Has anyone else who has switched from Windows found a good solution that gets something close to the "network drive" concept? Can someone explain in plain English how to use autofs (and whether that is a good solution or not)?

Any help greatly appreciated.

Will.


Yes I can try but you need to pay attention because this isn't going to be in 'plain english'. The simple and 'mac-like' solution in Leopard is drag your mount to the login items pane. I agree with you that this is not a good solution for many applications.

There is another way to do this that may meet your needs. As you suspected, it does involve using autofs but you don't need to know anything about that. What you have to do is add one line of text to a file called '/etc/fstab'. Then reboot your computer.

Let's agree on some terms:

<server> is the Computer Name of the machine that is sharing the disk
<share> is the name of the disk on <server>

Make sure that you can see and mount the share as Guest from the computer where you want to use the share. Do this in the Finder by clicking on the server name in the sidebar and making sure. Then on the computer where you want to automount the share add this entry to /etc/fstab:

<server>:/<share> x url net, automounted,url==afp://guest;AUTH=No%20User%20Authent@<server>.local/<share> 0 0

This goes all on one line. Then reboot your computer. If everything went right you should be able to find your share by looking under the 'All..' entry in the sidebar:

All->Servers-><server>-><share>

If things didn't go right the best way to debug the process is to check the url part of the /etc/fstab. That everything from 'afp:' to the end of '/<share>'. It's the most error-prone part and the easiest to mess up. So just copy that url, press cmd-K in the Finder (or select 'Connect to Server' in the 'Go' menu) and then paste the url into the server address dialog box. If the url is correct the share should mount without asking you for any credentials. If this doesn't happen you need to fix the url, the server or both. Once that's working make sure the url part of the /etc/fstab entry is exactly the same as what you put in the server address box and you're good to go.

Under Tiger there was a shareware utility called SharePoints that helped make this easy but it doesn't work with Leopard. Until the author writes a new version that works with Leopard you'll need to learn how to edit system files to get automounts working. But it's not very hard if you follow the directions and have some patience.

Jan 18, 2008 1:31 PM in response to bdinmstig

I'm using Leopard, and while I can navigate and log in to the SMB drive, I'm not getting a mount point on the desktop, nor do I see it in the browser listing for the HD or anywhere else.

The mount point I'm going to is a hidden volume on a Windows Server:

smb://username:password@server/XYZ$

I can mount it on the command line with smbclient, etc. I can navigate it when I Connect to Server, but just can't seem to figure out how to add this to someone's Login Items.

Pointers would be appreciated. Thanks.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Automatically mount network shares

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.