"ls" shows UID of 501 instead of username

Discussion in 'OS X Mavericks (10.9)' started by mélomane93, Mar 9, 2014.

  1. mélomane93, Mar 9, 2014
    Last edited: Mar 9, 2014

    mélomane93 macrumors newbie

    Joined:
    Mar 9, 2014
    #1
    My initial problem was I couldn't open IDLE, not from the applications folder or from terminal. After posting on the python "forums," it was brought to my attention that my "ls" shows a UID of 501 instead of my username. Next, I created a new admin account on my mac, and not only could I open IDLEl, but my "ls" shows my username(test) as my UID. I'm not sure exactly what this means, but I was told that it suggests an "inconsistently defined user account." Is there any way I can fix this without messing up my system?

    From Regular Account (Charlotte):
    Charlottes-MacBook-Pro:~ Charlotte$ /usr/local/bin/idle3.3

    Warning: unable to create user config directory
    /Users/Charlotte/.idlerc
    Check path and permissions.
    Exiting!

    Charlottes-MacBook-Pro:~ Charlotte$ cd ~
    Charlottes-MacBook-Pro:~ Charlotte$ ls -lde ~
    drwxr-xr-x 23 501 staff 782 8 Mar 22:49 /Users/Charlotte
    Charlottes-MacBook-Pro:~ Charlotte$ chmod u+w ~
    Charlottes-MacBook-Pro:~ Charlotte$ mkdir ~/.idlerc
    mkdir: /Users/Charlotte/.idlerc: Permission denied


    From New Account (Test):
    Charlottes-MacBook-Pro:~ test$ /usr/local/bin/idle3.3
    Charlottes-MacBook-Pro:~ test$ cd ~
    Charlottes-MacBook-Pro:~ test$ ls -lde ~
    drwxr-xr-x+ 15 test staff 510 9 Mar 12:25 /Users/test
    0: group:everyone deny delete
    Charlottes-MacBook-Pro:~ test$
    Charlottes-MacBook-Pro:~ test$ chmod u+w ~
    Charlottes-MacBook-Pro:~ test$ mkdir ~/.idlec
    mkdir: /Users/test/.idlec: File exists


    Any help would be greatly appreciated! :confused:
     
  2. SlCKB0Y macrumors 68040

    SlCKB0Y

    Joined:
    Feb 25, 2012
    Location:
    Sydney, Australia
    #2
    Can you confirm what the UID of user "Charlotte" is?

    Login as Charlotte, open a terminal and run the command "id".
     
  3. mélomane93 thread starter macrumors newbie

    Joined:
    Mar 9, 2014
  4. w0lf macrumors 65816

    w0lf

    Joined:
    Feb 16, 2013
    Location:
    USA
  5. ridnhard19 macrumors member

    Joined:
    Aug 24, 2009
    #5
    This is close but you should instead change the permissions on your home directory not the binary you already can execute.

    Code:
    sudo chown -R charlotte /Users/Charlotte
    You will have to do this as root (hence the sudo) as it doesn't think you are the owner of your home directory. Enter your admin password when requested.
     
  6. SlCKB0Y macrumors 68040

    SlCKB0Y

    Joined:
    Feb 25, 2012
    Location:
    Sydney, Australia
    #6
    This is where I was headed.

    OP - did you manually migrate the contents of your home directory from another Mac or account on this Mac?
     
  7. mélomane93 thread starter macrumors newbie

    Joined:
    Mar 9, 2014
    #7
    I used migration assistant between my old mac and this one. I believe at the time (2.5 years ago), I transferred my account from my old mac to my new one, and then I also made a new account on my new mac. Then once I transferred files over to the new account, I deleted my old account. That sounds a bit convoluted, I don't really know what logic was behind it, I think I wanted to start with a new account but wanted my files!?

    Anyhow, you are instructing me to do this:
    sudo chown -R charlotte /Users/Charlotte
    enter my password
    which will grant me permissions to my home directory? Is there anything else I need to do?

    Q: So the first Charlotte is my username and the second Charlotte is the name of my home folder?
    Q: Is it okay to do this from my "charlotte" account?
    Q: Is there a reason why the "c" in the first charlotte is lowercase?

    And I'm nervous performing this due to how powerful the root account is. Could this have any terrible results?
     
  8. SlCKB0Y macrumors 68040

    SlCKB0Y

    Joined:
    Feb 25, 2012
    Location:
    Sydney, Australia
    #8
    sudo escalates the privilege with which the command is run to "root"
    chown changes the ownership of files and directories
    -R makes the above command recursive so that ownership will be changed to all files and directories under and including /Users/Charlotte
    The "charlotte" after the -R specifies the username to set the ownership to. In this spot you could also specify a group if required. Eg:

    sudo chown -R charlotte:staff /Users/Charlotte

    This is correct
    Yes, this should be done in the terminal from your "charlotte" account but as mentioned above, the command will run with escalated privileges because of the use of sudo. This is required because you cannot change ownership of files not owned by you (they are owned by the non-existant user with UID 501) unless you have high enough privilege.

    Use "id" to get your correct Unix username and use this in the command. At worst, if the username does not exist the command will just error out.

    Any command run as root is potentially dangerous. This is particularly true of any command which is recursive as it has the potential to affect the whole system.

    For example, if you ran "sudo chown -R charlotte /" instead of "sudo chown -R charlotte /Users/Charlotte" it would change the ownership of every file and directory on your computer and would seriously damage things.

    For more information on these commands you can do the following from a terminal:
    man sudo
    man chown
     
  9. mélomane93 thread starter macrumors newbie

    Joined:
    Mar 9, 2014
    #9
    Thank you so much!! You've been so incredibly helpful!
     
  10. mélomane93 thread starter macrumors newbie

    Joined:
    Mar 9, 2014
    #10
    In case anyone has the same issue in the future and comes across this thread, I performed this tonight and it was a success. As you can see, I am now the owner of my home directory:

    Charlottes-MacBook-Pro:~ Charlotte$ cd ~
    Charlottes-MacBook-Pro:~ Charlotte$ ls -lde ~
    drwxr-xr-x 23 Charlotte staff 782 8 Mar 22:49 /Users/Charlotte
    and on top of that, I can now open idle.

    Thanks again! :)
     
  11. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #11
    Great, glad things worked out, It appears some blip in the migration assistant is what messed up privileges. I ran into a similar issue with my NAS and having ownership messed up, chown can fix it, but you need to be aware of the command :)
     

Share This Page