"ls" shows UID of 501 instead of username

mélomane93

macrumors newbie
Original poster
Mar 9, 2014
5
0
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:
 
Last edited:

ridnhard19

macrumors member
Aug 24, 2009
36
0
Code:
chown -R 503 /usr/local/bin/idle3.3
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.
 

SlCKB0Y

macrumors 68040
Feb 25, 2012
3,126
197
Sydney, Australia
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.
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?
 

mélomane93

macrumors newbie
Original poster
Mar 9, 2014
5
0
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?
 

SlCKB0Y

macrumors 68040
Feb 25, 2012
3,126
197
Sydney, Australia
Anyhow, you are instructing me to do this:
sudo chown -R charlotte /Users/Charlotte
enter my password
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

Q: So the first Charlotte is my username and the second Charlotte is the name of my home folder?
This is correct
Q: Is it okay to do this from my "charlotte" account?
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.

Q: Is there a reason why the "c" in the first charlotte is lowercase?
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.

And I'm nervous performing this due to how powerful the root account is. Could this have any terrible results?
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
 

mélomane93

macrumors newbie
Original poster
Mar 9, 2014
5
0
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! :)
 

maflynn

Moderator
Staff member
May 3, 2009
63,994
30,534
Boston
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 :)