Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Michelasso

macrumors 6502
Original poster
Feb 20, 2012
405
69
Treviso, Italy
I eventually managed to automount my NAS share on my MBP with macOS High Sierra. Since it's the MacBook that I take to work I need to have the shares remounting automatically when I come back home. This is so far how I implemented it:

/etc/automaster
Code:
#
# Automounter master map
#
+auto_master        # Use directory service
/net            -hosts        -nobrowse,hidefromfinder,nosuid
/home            auto_home    -nobrowse,hidefromfinder
/Network/Servers    -fstab
/-            -static
# Network Shares
# /-            auto_nfs    -nobrowse,nosuid
/-            auto_smb    -nosuid,noowners,browse,soft

/etc/auto_smb
Code:
/../Volumes/Storage    -fstype=smbfs,soft,noowners,noatime,nosuid,browse smb://NASuser:NASpassword@nas326/Storage

And this is how it gets mounted:
Code:
//admin@nas326/Storage on /Volumes/Storage (smbfs, nodev, nosuid, automounted, noowners, noatime, nobrowse, mounted by MacUser)

It works, it's decently fast (I reach 110MB/s reading) but it doesn't please me much. What I'd love to do is to remove the password in clear, having mount_smbfs (from the automount) picking the password from the keychain as suggested in the last "solution" in this ServerFault question.

Also I am not able to remove that "nobrowse" option, which I believe is the one preventing the finder to show the automounted network drive (hence the "browse" option as a desperate try, since it isn't documented). The idea would be that other than showing the drive, it would also be same mounted by the Finder is I access the share via CMD-K.

Any idea about how to make it working? Thanks.
 
Well, I have already tested the Automounter app (which is much cheaper than Expandrive) and that would do the job too. Although it seemed quite slower than the automound solution.

Still I am not fond on the idea to pay for something that should (must) be easily done via system configuration files. I mean, putting the password in clear automountd works. It just doesn't show the drive in Finder. Also, being an Unix sysadmin, I'd really want to dig what the heck Apple did. If I give a mount option that should apply!!
 
  • Like
Reactions: hwojtek
I can't get auto mount solution in Catalina 10.15 beta

Anyone has this problem? I use the auto_smb solution in previous macOS
 
You should check your auto_master and hosts files in /etc. Apparently the beta installations reset them. It's better if you make a copy of them after they are fixed, because otherwise at each update it's a pain.
 
Well, I have already tested the Automounter app (which is much cheaper than Expandrive) and that would do the job too. Although it seemed quite slower than the automound solution.

Still I am not fond on the idea to pay for something that should (must) be easily done via system configuration files. I mean, putting the password in clear automountd works. It just doesn't show the drive in Finder. Also, being an Unix sysadmin, I'd really want to dig what the heck Apple did. If I give a mount option that should apply!!

I am trying to figure out this for a new Mac Mini server I am setting up for home files. Is there seriously no map network drive option in MacOS? How does Windows best Mac on that?

What if we used an active directory type domain? Could it auto mount then?
 
Here is a quick and dirty solution that works with the credentials saved in Keychain:

1. Mount the share in the Finder by pressing Command+K and check "Remember this password in Keychain" when logging in.
2. Select the drive icon on the Desktop and press Command+Control+A (or File > Make Alias).
3. Put the alias someplace unobtrusive. I put it in the user's home directory (or in /Users/Shared depending on how many users are using the Mac).
4. Add the alias to Login Items in Users and Groups in System Preferences. Check the Hide box if you don't want the window popping up on login.

The alias is just a pointer/address. The credentials get pulled from the Keychain.

If you want to set it up for additional users, you can use the same alias in their account and save their credentials in Keychain on the first connection.

I think the only way to do it using AD or OD credentials would be via a configuration profile and the Profile Manager built into the Server app or an MDM solution. That is the Mac equivalent to a user/group policy on Windows.
 
Here is a quick and dirty solution that works with the credentials saved in Keychain:

1. Mount the share in the Finder by pressing Command+K and check "Remember this password in Keychain" when logging in.
2. Select the drive icon on the Desktop and press Command+Control+A (or File > Make Alias).
3. Put the alias someplace unobtrusive. I put it in the user's home directory (or in /Users/Shared depending on how many users are using the Mac).
4. Add the alias to Login Items in Users and Groups in System Preferences. Check the Hide box if you don't want the window popping up on login.

The alias is just a pointer/address. The credentials get pulled from the Keychain.

If you want to set it up for additional users, you can use the same alias in their account and save their credentials in Keychain on the first connection.

I think the only way to do it using AD or OD credentials would be via a configuration profile and the Profile Manager built into the Server app or an MDM solution. That is the Mac equivalent to a user/group policy on Windows.

How practical would Mac Server be just for this purpose, i.g. user account provisioning and auto mounting in a multiple Apple device household?
 
I am trying to figure out this for a new Mac Mini server I am setting up for home files. Is there seriously no map network drive option in MacOS? How does Windows best Mac on that?

What if we used an active directory type domain? Could it auto mount then?

Well, the instructions in the initial post are still valid, I am currently using that same configuration in macOS Macalina. My major issue is that the password for the remote share is in clear. But in Terminal you can "chmod 600 /etc/auto_<your file>" so that only root can read it.

That and the fact that auto_master gets reset at each new beta/new macOS release (?) installation. It needs to be backed up and restored after each new installation. Apart from that it usually work, no need for external apps.

Still I use it in a single user (per host) environment. I am not sure what would happen having the same automounted remote share accessed by different users (with different UIDs) in the same machine. I use the same share between my Mac and Infuse on my Apple TV. The question is what will happen if one switches to a different user in a Mac.

Otherwise, if your goal is to have different remote folders for different users in different Macs, you may try NFS. Which is more a Unix thing. SMB works better in Windows because it has been adopted by MS.

PS: I don't know about Mac Server. But if your goal is also to access remote folders from an iPhone I don't think iOS (nor Android) natively allows to do it. Only via apps with SMB/NFS/Other enabled, like Infuse on tvOS.
 
How practical would Mac Server be just for this purpose, i.g. user account provisioning and auto mounting in a multiple Apple device household?
If you're running anything newer than mac OS 10.12, you don't need server. Apple removed File Sharing from the server app. You now control all of it in the Sharing system preferences pane. However, the GUI for several essential settings/controls has also been removed entirely, leaving the only option as the command line and it is getting much more difficult to get the results you want. The key one being Access Control Lists and inheritance.
 
@palebluedot Ah, sorry, I have got it the other way around. I confused the server with the client. If you need to share a folder in your Mac Mini as a remote resource do as @sevoneone said. The configuration in this thread was about setting up a SMB client with automount, which is what confused me.
 
@palebluedot Ah, sorry, I have got it the other way around. I confused the server with the client. If you need to share a folder in your Mac Mini as a remote resource do as @sevoneone said. The configuration in this thread was about setting up a SMB client with automount, which is what confused me.

Thanks for the reply! That is actually what I am getting at too. I want all apple devices (and the iOS devices when Apple released smb for iOS) to auto mount to a network drive ala a corporate type network but in my home. I thought perhaps the more elegant solution to do so would be to use a server that pushes out "policy" to force an auto mount, but in reading further it seems like macOS can't really do this the way Windows can.
 
Thanks for the reply! That is actually what I am getting at too. I want all apple devices (and the iOS devices when Apple released smb for iOS) to auto mount to a network drive ala a corporate type network but in my home. I thought perhaps the more elegant solution to do so would be to use a server that pushes out "policy" to force an auto mount, but in reading further it seems like macOS can't really do this the way Windows can.

Ok, talking now about the client side you can make it working on a Mac as described in the OP. About iOS 13, I see it now that it is possible to connect to a SMB share via the app "File". In the main page click the 3 dots on the top right and choose "Connect to server" (I am translating, my iPhone is in Italian). Then use the hostname <SERVER>.local (I have a NAS as a SMB server. In your case it should be the Mac Mini <hostname>.local). Choose if anonymous or registered user with username/password and it does connect! Then you can move files around, watch images, play .mov (supported) videos and so on. Not sure if it will integrate with other apps, but in File once added it should stay.

Here is an article about it.
 
Has anyone managed to make automount (with the auto_* files) working in macOS Catalina beta 5? Apparently Apple changed few things and it doesn't like the path "/../Volumes/<directory> anymore..
 
Yes, been hacking away at it. Try changing your "/../Volumes/<directory> to /System/Volumes/Data/Volumes/<directory> and let me know if that works for you. I was able to mount using this same method but pointing to the new data volume created in Catalina for security. They then show up in finder under volumes.

I actually changed them to my home folder the same way using /System/Volumes/Data/Users/Dan/<directory>
 
For anybody that is using a directory server...NoMAD is a handy tool that happens to have a nice server shares menu that works well with keychain, and I see an automount option.

Have not tried it with 10.15 yet. Works great on 10.14 and 10.13.

Might be some useful info for those trying to roll their own automounts too.
 
Yes, been hacking away at it. Try changing your "/../Volumes/<directory> to /System/Volumes/Data/Volumes/<directory> and let me know if that works for you. I was able to mount using this same method but pointing to the new data volume created in Catalina for security. They then show up in finder under volumes.

I actually changed them to my home folder the same way using /System/Volumes/Data/Users/Dan/<directory>

Sorry for the delay, but it was on my low list of priority. I tried the solution you suggested, but it wasn't creating the folder in /Volumes. I did a little search and I have found this gist. Using the line:

Code:
/System/Volumes/Data/../Data/Volumes/NAS326     -fstype=smbfs,soft,noowners,noatime,nosuid,browse       smb://admin:PASSWORD@nas326/NAS326

It works as before! Now if anyone has any idea about what that
Code:
/../
means in automount configuration file...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.