Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Automount share as non ROOT or SYSTEM user!

The most annoying bug I've found yet!


I have two machines, an iMac and a Mac Book Pro.


The MBP was an upgrade from 10.6.8 to 10.7 the iMac was a full reinstall (erased the drive and booted off a flash installer I made for 10.7)


The MBP was previously configured (in 10.6x) to automount a few AFP shares from my local NAS. This had been working perfectly. After upgrading to lion, the entries in /etc/fstab were still there and the shares are still functioning fine.


I added the EXACT entries from the fstab file on the MBP to the fstab on the iMac. Now when the iMac boots the AFP shares are automounted by the system/root user and therefore are not accessible to any normal (admin) user on the iMac. No matter what I try I can't get it to automount those shares as a non system/root user. Clearly something changed with AFP configuration in Lion, yet the upgraded MBP still funcitons as it did before, so some new default automount / autofs setting has changed yet it wasn't touched in the upgrade. I'm wondering if anyone is aware of an AFP or Automount or autoFS setting I can try changing on the iMac to get this working?


To test things further, I changed the FSTYPE in fstab from afp to cifs just to test and it still mounts the shares as the root/system user. Yet if I use mount_afp or mount_smbfs it will obviously mount those shares as the user that is running the command, which is desirable. The only problem in doing this is if I disconnect from the network or the share drops it will not automatically reconnect and I'd have to run the command again.

iMac, Mac OS X (10.7), Extreme 2.8ghz 16GB RAM

Posted on Jul 28, 2011 10:26 PM

Reply
36 replies
Sort By: 

Aug 22, 2011 2:36 PM in response to abricko

It seems to work fine here. I normally use MacFUSE but I was able to get AFP working too. The big difference is that SSH actually has more capability because Keychain provides ssh-agent. I can therefore login without hard-coding a password anywhere. That isn't as easy to do with AFP. It may be possible, but not easy.


Can you list what your config files look like?

Reply

Dec 3, 2011 11:22 AM in response to angeloalberico

Okay I just had to reboot my MacMini system because of trying to get something else fixed and found that my mount point didn't come back up with user permissions (root only). So I did the following.


  1. Removed entry from /etc/auto_afp
  2. Restarted autofs (automount -vc)
  3. Removed the mount point in /Volumes
  4. Readded entry to /etc/auto_afp
  5. Restart autofs
  6. Checked Share and had access


My mount point is /Volumes/Media and when I removed if from autofs and restarted autofs the mount point was left behind with incorrect permissions. I removed it and DID NOT recreate it before restarting autofs again. This seemed to have fixed the permissions issues. However, this did not survive a test reboot of the system, so it looks like maybe when autofs is shutting down it doesn't remove the mount point?


Don't know.

Reply

Aug 16, 2011 2:56 PM in response to abricko

I used these instructions to attempt the same thing. I got the same results described above: the share mounts, but only root can get into it. Instead of being owned by the user account and the "staff" group (which is what you get if you use Command-K in the Finder to mount a share), the automount directories are owned by root/wheel. Try to Chown the shares to yourself and nothing happens. No error, and no chown.


I called Apple for help and they said that anything involving command-line stuff is user-supported. :-(


I'll post back if I fingure anything out.

Reply

Aug 22, 2011 2:18 PM in response to abricko

FYI -- I was just now able to "wake up" the mounts and have them be visible again by issuing an 'automount -vc' command in the shell as root. It took a minute or two for the folders to all become visible, but they are now accessible. I don't know how long it will last, since they seem to go to sleep after a while. Maybe it's a workaround until something more robust gets figured out...?

Reply

Nov 7, 2011 7:02 AM in response to hugoduraes

hugoduraes wrote:


So, how can we warn Apple about this issue?


I'm not an expert on auto-mounting by any means. So if this is something to warn Apple about or is more of a make this nicer feature request, is left up to someone who is.


As always, to contact Apple: www.apple.com/feedback

Reply

Nov 7, 2011 8:35 AM in response to hugoduraes

I suggest starting your own thread to discuss whatever problem you are having. The original poster has one out of two machines misconfigured. We have not been able to reproduce any problem so there is not yet anything to report to Apple. If you explain your issue in more detail, we may be able to find out what is wrong.

Reply

Dec 2, 2011 6:21 PM in response to abricko

Possible Fix that I found from different posts across the Internet.


I was originally mounting AFP shares from my NAS by putting the following line in my /etc/fstab file


(hostname):(share) (mount_point) url automounted,url==afp://(username):(password)@(hostname)/(share) (mount_point) 0 0


This was on an MacMini with 10.6, on my laptop with 10.7 I tried the same line and it gave me the permissions issue as abricko had. Now my MacMini is also giving me issues when it reboots. Researching the vast Internet I found the suggestion of creating a seperate auto_afp file for Autofs to use so here is what I did.


Create and set permissions

$ sudo touch /etc/auto_afp

$ sudo chmod 600 /etc/auto_afp


Open for editting

$ sudo vi /etc/auto_afp


Place the following style entry for your NAS

(local_mountpoint) -fstype=afp afp://(username):(password)@(hostname)/(share)


Make autofs aware of auto_afp

$ sudo vi /etc/auto_master


Add the following line

/- auto_afp -nosuid


Restart autofs

$ sudo automount -vc


This "seems" have worked for me. I completely unmounted everything, made these changes and the share appeared at my mount point and I could access it as my user (mountpoint permissions are 700 user:wheel).



Hope this helps someone.


Message was edited by: bmorgenthaler

Reply

Dec 2, 2011 7:08 PM in response to etresoft

etresoft wrote:


Nice post! Do you know how to remove the password from the file? I have a link to another thread that uses C code. It would be nice if Lion had something built-in.


Unfortunately I do not, mount_afp doesn't support a -o credetials=/some/file/some/where like mount_cifs does so you can't put that into the auto_afp file.


That best protection for this setup is the chmod 600 on the file so only your admins can read it. Unfortunately if everyone is an admin, eh not so good.

Reply

Dec 2, 2011 10:09 PM in response to bmorgenthaler

Thanks for the tips, I've tried all of these before, and just tried it again, still, they end up mounted as root.


The mountpoint's folder perms show as (no matter what I do before or after mounting):


dr-xr-xr-x 2 root wheel 1 Dec 2 21:51 files-3



When I simply type "mount", that mount shows as:


map auto_afp on /Volumes/NAS/files-3 (autofs, nosuid, automounted, nobrowse)



Where other shares that I mount using "mount_afp" will add to this to the end of the ( ) area: "mounted by user"


I've tried changing the mount point to my a folder inside my home folder, it's stll mounted as root and chowned to root. I've tried chowning the auto_afp and auto_master to user:wheel, nothing seems to change it.


I'm bummed, becuase CLEARLY something changed in Lion, this ALL worked PERFECTLY and it was awesome to have on demand mounts (specially for the laptop when I would leave the NAS at home and come back)


Unfortunatley I've had to resort to a stupid script that I will run that runs mount_afp commands which properly mounts the share as my user, I've also added some options to make it more "sticky" (ie it takes longer to time out) but again, it's FAR from perfect like autofs was.

Reply

Dec 6, 2011 9:00 PM in response to bmorgenthaler

I've been having this problem as well on Lion. Snow Leo worked fine, exact same configuration. Even if I remove the mountpoints, they get re-created properly, however, they are mounted with root permissions. It's really bizzare. I expect Apple did something in the name of security, that broke the only use case I can see for the autofs daemon......


I wonder if we can replace it with a compiled from source version from BSD or something.....

Reply

Dec 9, 2011 7:51 AM in response to Travis Tabbal

Damnit Apple. NFS works till you try to use it, then you get disconnect errors. The only conclusion I have at this point is that autofs is totally broken in Lion and is useless. On the box I really need this functionality I'll probably have to revert to snow leopard as it worked perfectly there and the changes is Lion don't matter to me on that machine. Drives mounted directly via cmd-K work fine, so it has to be autofs, not the network/sharing stack or the server side.


Hacks like using login items are not sufficient for everyone. The biggest problem is that they don't auto-reconnect if the server reboots or the network disconnects etc.. IMO this is a really basic function of any Unix based OS these days and having it so broken is a huge failure in QA. If they don't want to support the normal autofs daemon, then they should completely remove it and move the functionality to the GUI. In this day and age of pervasive home networks, there is no excuse for not having the equivalant of the stupid automount checkbox that Windows has had since Win95. Ideally, they would fix autofs and provide a simple UI for it like that checkbox in Windows when mounting a drive.

Reply

Dec 9, 2011 8:09 AM in response to Travis Tabbal

Actually I'm having the opposite problem. My MBP /w Lion automounts just fine with userlevel permissions when I put an entry into /etc/auto_afp. It is my Mac Mini /w SL that is the one that is borked and doesn't function properly after a reboot of itself or a network disconnect from the server.

Reply

Automount share as non ROOT or SYSTEM user!

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