I'm sharing a local folder on a 10.8.5 Mac Mini server via AFP. The share is set to allow a certain user group to write to it. When users in this group place files in the directory, they are owned by that user. The problem is that spotlight will not index these files. If I chown
one of the files to the local admin user, it immediately gets indexed by spotlight.
# Observe the initial file ownerships:
$ ls -el /Shared/mds-test-doc.pdf
-rw-r--r--+ 1 otheruser wheel 36279 May 7 15:23 /Shared/mds-test-doc.pdf
0: group:somegroup inherited allow read,write,execute,append,readattr,writeattr,readextattr,writeextattr,readsecurity
# Observe that mdfind doesn't see it (or any other files containing a period
# character within that directory)
$ mdfind -count -onlyin /Shared '.'
0
# Change the file's owner to adminuser:
$ sudo chown adminuser /Shared/mds-test-doc.pdf
# Sanity check the new ownerships:
$ ls -el /Shared/mds-test-doc.pdf
-rw-r--r--+ 1 adminuser wheel 36279 May 7 15:23 /Shared/mds-test-doc.pdf
0: group:somegroup inherited allow read,write,execute,append,readattr,writeattr,readextattr,writeextattr,readsecurity
# Now mdfind sees it:
$ mdfind -count -onlyin /Shared '.'
1
# Remove the -count to confirm it's the expected file:
$ mdfind -onlyin /Shared '.'
/Shared/mds-test-doc.pdf
So as you see, just re-owning the files allows them to be indexed (instantly I might add). Obviously one fix would be simply recursively owning all the folder contents. Many web solutions I've found suggest doing this or making the Repair Disk Permissions tools to do it for you. Such a solution isn't ideal because:
- the files are supposed to be owned by
otheruser
- a recursive
chown
only fixes files at that moment, so it would need to be executed periodically (launchd/cron job) to keep the files up-to-date and indexed
Is there a better way of fixing this? Maybe I'm missing a server or spotlight setting somewhere?