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

Dec 22, 2011 11:56 AM in response to abricko

Apologies if someone already said this.


I was having this problem too. Here are the bad permissions on the mountpoint:


[bwood@ucbmbp ~]$ sudo ls -ld /Users/bwood/share

dr-xr-xr-x 2 root wheel 1 Dec 21 23:38 /Users/bwood/share


I resolved the root ownership of mountpoint on 10.7 like this:


1. as normal user create the mountpoint directory: mkdir ~/Linkstation

2. make the needed edits to /etc/auto_master and (in my case) /etc/auto_smb. My auto_smb contains


/Users/bwood/Linkstation -fstype=smbfs ://admin:PASSWORD@192.168.0.160/share


3. sudo automount -vc


[bwood@ucbmbp ~]$ sudo ls -ld /Users/bwood/Linkstation/

drwx------ 1 bwood wheel 16384 Nov 27 20:46 /Users/bwood/Linkstation/



[bwood@ucbmbp ~]$ ls Linkstation/

caroline monk trashbox voutcity

Dec 22, 2011 1:18 PM in response to bmorgenthaler

I tried creating the directories for mount points as a normal user. The autofs daemon would change the permissions for me....


I got NFS working properly. Added "locallocks" to the mount options. Here's a sample line:


Travis -rw,rwsize=1048576,vers=3,noatime,intr,soft,locallocks 10.1.0.2:/raid/Travis


Now the mounts work properly and don't disconnect constantly. I never did get SMB reliably working.

Mar 12, 2012 10:00 PM in response to bmorgenthaler

Looks like mine with "noowner" are working:


in /etc/fstab I have


192.168.89.105:/music /Users/Deborah/Shares/music url automounted,noowners,url==cifs://(username):(password)@192.168.89.105/music 0 0


and /etc/automaster has

+auto_master # Use directory service
/net -hosts -nobrowse,hidefromfinder,nosuid
/home auto_home -nobrowse,hidefromfinder
/Network/Servers -fstab
/- -static


I had to remove the entries from fstab, issue a sudo automount -vc to remove the mounts, then manually create the mount point at /Users/Deborah/Shares/music using mkdir music, then sudo chown Deborah:staff /Users/Deborah/Shares/music, then put the entries back in fstab, and do another sudo automount -vc to mount them again.


It's too early to say for sure whether this will last any length of time.


In Snow Leopard I didn't have the noowners option, and it worked fine. Must have broken when upgrading to Lion. With noowners, everything in the share is owned by the current user, which is fine for me since I don't rely on the user permissions within my NAS.

Mar 27, 2013 1:12 PM in response to surroscape

surroscape wrote:


This works for me. I think the key is setting the mount point in your home directory instead of /Volumes/


my configs looks like this


I added this line to the end of /etc/auto_master:


/- auto_smb




and created the file /etc/auto_smb:


/Users/er0k/mount -fstype=smbfs,soft ://er0k:password@server/mount



I had a problem with this as well. Apple must fix this! In the mean time, however, here is something that works on OSX 10.8.


Follow the procedure 'surroscape' suggested. However, on OSX 10.8 the shares will mount as root owner. To fix this run this:


sudo umount /mount/point


This will unmount that share. It should automatically remount with your user permissions automatically. I know, it's idiotic, but it works. Apple, FIX this!

Aug 28, 2016 4:35 PM in response to abricko

The solution to this is to enable the Guest account in the NAS server with Read/Write permissions set for the volumes you try to share with AFP. If you use a personal home NAS this should not be a problem.


My NAS line in /etc/auto_master:


/automount/NAS auto_nas

and my /etc/auto_nas:

Netdisk -fstype=afp afp://192.168.1.1/Netdisk

# ls -als /automount/NAS/

total 2

2 dr-xr-xr-x 3 root wheel 2 Aug 29 02:26 .

0 drwxr-xr-x 3 root wheel 102 Aug 29 01:53 ..

0 drwxrwxrwx 1 root wheel 330 Aug 29 02:21 Netdisk

Sep 25, 2016 6:14 AM in response to LefterisT

No matter what I tried the autofs mounts would eventually be mounted as root. Possibly they are idling out and some root-user background process is trying to access them and this is causing the disks to be re-mounted as root.


Anyway inspired by another user's approach I wrote a small shell script with a plist file that runs it every 15 seconds to keep the disks mounted as the desired user.


See here - https://github.com/scotartt/shell_scripts

specifically : https://github.com/scotartt/shell_scripts/blob/master/fix_mounts.sh

and https://github.com/scotartt/shell_scripts/blob/master/org.autonomous.fixmounts.p list

Oct 10, 2016 1:24 AM in response to scotartt

The problem is fixed for me. Automount works again.

Here is what I did:

- deleted the old shared volume item in user startup items.

- deleted any entrys regarding the NAS (Synology) in the keychain.


PLUS:


- installed the latest cricial update for my Synology NAS (6.0.2 update 2)


Then:

restart Mac, connect to shared volume in finder with cmd+k, drag connected share into user startup items.

-> automount works again.

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.

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.