changing my uid...


Official Volunteer
I attempted to change my UID with the Netinfo manager so that i would match the UID use by the other machine on the netork we have, but when I restarted to see what woulf have, everything was prett messed up. All the application icons were missing. It was like all the preferences were gone.:confused:

Luckly I thought ahead enought to make another user with admin priveledges so i could change the UID back and everyhting was fine.

Why didi this happen?

Is there another way to change my UID?



What happened was your UID was changed in NetInfo, so your username mapped to that new UID; however, all your files were still owned by the old UID, which means you no longer had access to any of them (or at least many of them). To make this work, you need to modify your user entry to the new UID, then run (at the console, or a Terminal from your second user),

sudo find / -user 501 -exec chown username {} \;

where 501 is your OLD UID and username is the name of the user you changed. This will find all orphaned files and change ownership back to you. Note that find syntax can become very odd, so be sure to copy that line so you don't miss anything...


Yes, you changed the UID but never changed ownership of the
existing files.

It's alot faster to use xargs instead of the -exec option to 'find'.

find / -user 501 |xargs chown username

Although, in reality, 99+% of the files owned by 501 will be in the /Users/<old username> directory so you may just want to

cd /Users/<old username>
sudo chown -R <new username> .

The -exec command fires off an entire new process for every file it finds.


I too prefer using find | xargs, however, it tends to not like filenames with spaces in it:

touch "/tmp/the file name"
find /private/tmp -type f -print | xargs ls -l

ls: /private/tmp/the: No such file or directory
ls: file: No such file or directory
ls: name: No such file or directory

hence the use of exec...


Yea, forgot about that.

Real UNIX files dont have spaces, they're just looooooooooong ;)

Thanks for catching that.


X caught it for me the first time I did that, when doing a find | xargs grep...I saw the results, and thought, "Oh, yeah, spaces".


Official Volunteer

i ran

sudo find / -user 501 -exec chown username {} \;

as you suggested as another user, and it didn't work the first time through, so i decided to tri it as root and removed the sudo, and it work perfectly.

thanks for the help.


mach-o mach-o man
Perhaps I ran into the same trouble....
The day (more like night) os X was officially released, I got it. I installed it, and the first user I created (in the initial setup program) was named 'root'. BAD BAD BAD BAD IDEA!!!!

Everything was a stupid white icon. I couldn't even run Sherlock. The system was totally messed up.
I called Apple, and they didn't have a clue (at least the first guys who handled my call).

Apple called me (that in its self is pretty cool) the next day, and I told them about all the hardware I had.... they didn't know what it was.

Then the next week (I just decided to call every few hours for a few days straight), I talked to someone who really knew what was going on. He asked me about my user name. 2 hours later (re-install), I was up and running.

Moral of story: He who play with root mess up tree.

(However, now I'm back playing with root, so whatever)