1

I migrated my OSX System from one machine to another. Everything works fine, but when I check the files under /usr/local, they now belong to a user 502, not my newly created user (which has the internal id 501).

Problem: even with sudo,

chown (-R) <username>:admin 

did not work, the files remain unchanged.

How can I get rid of user 502?

Update: It seems normal files/dirs are changed, but symlinks aren't.

1 Answer 1

1

As you have determined yourself you need to chown the files owned by user 502 to 501. You can do this with:

find / -user 502 | xargs chown username:admin

This will find all files and directories owned by user 501 and chown them to username:admin.

5
  • Thank you ... while this helped a lot, all symlinks (and thats many, since I am in the brew Cellar) are not changed. I will update the question. Apr 9, 2014 at 20:06
  • You can update symlinks with with chown -h username:admin filename
    – mtak
    Apr 9, 2014 at 21:29
  • The -h flag did it. My Solution: for f in find . -user 502; do echo $f; chown -h <username>:admin $f; done Apr 9, 2014 at 21:48
  • The | xargs-way would have worked just as well, and is probably faster ;)
    – mtak
    Apr 9, 2014 at 21:51
  • It did not work right away, so I used the loop to print out some debug. Apr 9, 2014 at 21:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .