I can verify that a similar phenomenon has occurred on my Mac: I have MacPorts 2.3.3 installed (on OS X 10.9.5), and user macports
recently took ownership of many seemingly random files on an external drive that I use regularly, including media files and applications.
I noticed the problem because suddenly today I could not download from Firefox to my designated downloads folder, which is on the external drive; after examining the downloads folder, I noticed that the user and group of the folder had been changed to macports
, and was read-only for other users. After some searching, I discovered that user macports
had commandeered a number of other files on the external drive unrelated to MacPorts.
The previous answer worked for me, e.g.:
sudo find /Volumes/External -user macports -exec chown $USER {} +
However, that only changes the user, and I needed to change the group too, e.g.:
sudo find /Volumes/External -group macports -exec chown :staff {} +
MacPorts ticket #41039 discusses a similar issue and may shed some light on the origins of the problem: https://trac.macports.org/ticket/41039
Update: I have determined that the probable cause of the problem, in my case, is that I occasionally connect my external drive to other Macs, and on one of those Macs (let's call it Computer B) the user account that I use has uid=502 (MacPorts is not installed on Computer B). User macports
on the other computer (let's call it Computer A, on which MacPorts is installed) also has uid=502. So after I have used the external drive on Computer B, later when I mount the external drive on Computer A, any files that I created or modified on Computer B will have user and group macports
on Computer A.
So, for example, any files that were created on another computer with uid=502 and then are copied to a computer that has MacPorts installed (where user macports
has uid=502) will be owned by user macports
on that computer. Or, if you once had a user account on your computer with uid=502, but then you delete that account and later install MacPorts, and then user macports
uses uid=502, all of the remaining files that were once owned by the deleted user account will now be owned by user macports
.
Thanks for your answer Lauri, could you please explain to me what the {} + part does exactly? – None – 2013-07-16T15:44:00.940
See
man find
.{}
is a placeholder for arguments, and+
tells-exec
to take multiple arguments at a time. – Lri – 2013-07-17T08:55:55.093