Is it safe to assign multiple UIDs to a user account?

Discussion in 'Mac OS X Lion (10.7)' started by Dark Goob, May 8, 2012.

  1. Dark Goob macrumors regular

    Dark Goob

    Joined:
    Jun 6, 2007
    Location:
    Portland, OR
    #1
    I have the slight problem that my current Lion user account is the result of migrating from various Macs and various systems since 10.0.

    I.e. I have always Upgraded when new OS X versions came out, and I have always used Migration Assistant when I have purchased a new Mac.

    Needless to say I have migrated and upgraded quite a few times since 2001 when I first started using OS X.

    When you migrate it increments your UID if you already had a user account on the machine you migrated to. So for example my user account's original UID was 501, but then it became 502 when I migrated. Another time I migrated, it became 503. After that I got wise and started cloning my drive instead of migrating, but I still have a lot of files set to 502 and 501.

    On Snow Leopard, I made a group that contained 501 and 502 in it, so they could access each other's files no problem. That cleared up any issues. But then when I went to Lion it erased all my users and groups and I have had to recreate the users and groups based on the existing directory structure.

    That all went smoothly. But unfortunately there are a lot of files still set to 501 or 502, and I'm getting lazy. I don't want to manually go through and set them all to 503 using chown.

    So my question is, why can't I just go into /System/Library/CoreServices/Directory Utility as the root user, and edit my main user account, simply adding 501 and 502 to the UID field along with 503 for that user?

    I'm afraid it feels like a _bad idea_.

    I tried it anyway, and interestingly enough, all the files that were showing up as owned by "502" now say my user's name, which is good. That's all I care about, is that I don't see a non-Mac-like number anywhere, or get any non-Mac-like warnings about how I don't own my own gordrarned files.

    Is it really a bad idea? What will happen if i log back in as that user and keep using it? The top value in the array is still 503... so won't it keep using that as the main UID, and just give me full access to 502 and 501 as well since I added those and there are no other user accounts with those UIDs?

    Thanks,

    - a guy who's wishing the Mac was still like a Mac

    PS -- I made a smart folder of all the 501- and 502-owned files in Finder, but when you select all, and option-command-i, you can't batch change the owner! Further you can't navigate into a smart folder in the Terminal... it says it's not a directory. Phail.
     
  2. Bear macrumors G3

    Joined:
    Jul 23, 2002
    Location:
    Sol III - Terra
    #2
    Your best bet is to clean up the UID situation.

    In terminal you can use:
    Code:
    cd /directorywith/files/to/change
    sudo find . -uid 501 -exec chown 503 {} \;
    sudo find . -uid 502 -exec chown 503 {} \;
    If everything you want to change is under your home folder, you can cd to there.

    You want to be careful using the above on system files.

    The above was based on 501 and 502 being the old uids and 503 being the current one.
     
  3. darkgoob macrumors 6502

    Joined:
    Oct 16, 2008
    #3
    Awesome, thanks! I should've known there'd be an awesome unix-beard solution!

    Now I can eat breakfast.
     

Share This Page