Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a small problem with my permissions. I use rsync frequently on a certain target directory, but one day I by accident I used "sudo rsync", and now all my permissions for the files in the directory have been changed to user 502. Can anyone provide me with a clue as to why this happened, and why user 502? thanks.

share|improve this question

migrated from Sep 28 '11 at 2:23

This question came from our site for professional and enthusiast programmers.

When you create an account on a Mac, it is 501.

The 2nd account you create is 502. And so on.

When you use rsync, it copies the files as your User ID because that's all a non-root user can do.

When you ran rsync as 'sudo' it thought you wanted to copy the user as well as the file.

You should be able to fix it with

sudo chown -R $USER /path/to/rsync'd/files/

ps - you can see your user number using the id command in Terminal.

share|improve this answer
find /Applications -iname '*.app' -user 502 -or -user root -maxdepth 1 -exec sudo chown -vR $USER:admin {} \; – Denji Aug 28 '14 at 19:18

It's much easier to just delete and recreate your users.

You can see which user has 501 (if any) with the id 501 command. Delete that user and keep the home directory.

Then delete your 502 user (you'll need to make a third admin account to do all this deleting). Again keep the home folder.

Go into terminal and use sudo to mv /Users/short\ (Deleted) /Users/short and then take care to add that user back using the system preference. It will change all the 502 permissions back to 501. You can then recreate the offending 501 user (if it was still around) and it will become 502.

Much easier in the long run - as long as you don't delete the home folders, you won't loose any files and the UID will match again with your primary users on both machines being 501.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.