-
All replies
-
Helpful answers
-
Nov 1, 2013 8:27 PM in response to Chazzzzyby Chazzzzy,Wow.. horrible grammar on my post!
Basically, most User Home Folders have incorrect ownership, it seems like the server just randomly assigned ownership of a bunch of user directories to other random users.
I went into terminal and then:
cd /
cd Users/
ls -al (to see who owns what)
for example:
drwxr-xr-x+ 11 vannick staff 374 Jul 16 17:38 bryan
drwxr-xr-x+ 11 jon staff 374 Jul 16 17:39 vannick
Vannick owns Bryan's home folder and Jon owns Vannick's!
so I then typed:
sudo chown -R vannick:staff vannick/
And it changed the ownership of vannick's home folder and sub folders to himself.
and
sudo chown -R bryan:staff bryan/
and it corrected Bryan's home folder and sub folders.
Not sure if there will be any issues for having done this!
-
Nov 2, 2013 8:48 AM in response to Chazzzzyby MrHoffman,Make a backup.
Verify the disk.
Invoke the chown commands. I'd use a script if there's more than a couple of users, both so you can test the commands, and to avoid errors when entering each.
How things got messed up is an open question.
-
Nov 6, 2013 10:41 AM in response to Chazzzzyby FrankyHall,Hi Chaz,
Sorry you've had this problem. It sounds painful, but there is probably more than one easy fix. I've thought about this a bit and I cannot really understand why your user's UID (user id numbers) changed. Try this:
ls -ln id vannick id jon id bryan
With these commands you can see the uid that owns the files and your users' ids. This can be helpful for determining what happened. I'm curious and I wonder if you can post the output to those commands for those users? I'd like to see what the old id was and the new id. It might give us an idea what happened.
This little for loop should fix all your users' home folders ownership.
cd /Users ; for i in *; do sudo chown -R "$i" "$i";done
I did it on my system. The output for that is below. Any folder that does not match a username will produce the error you see for Shared. This is no big deal (and might give you more info).
david@MAC206:/Users$ for i in *; do sudo chown -R "$i" "$i";done chown: Shared: illegal user name david@MAC206:/Users$ ls -l
total 0 drwxrwxrwt 12 root wheel 408 Oct 24 12:27 Shared drwxr-xr-x@ 57 david staff 1938 Oct 30 12:01 david drwxr-xr-x+ 16 sysadmin staff 544 Jul 25 10:39 sysadmin david@MAC206:/Users$Regards,
Franky Hall
-
Aug 1, 2016 9:51 AM in response to FrankyHallby EOC Admin,Franky,
Can you tell me how I could modify this command to delete home folders that have no user assigned?
So of every folder that comes back with "illegal user name" would then be deleted.
We have a server that we deleted a bunch of users from but their home folders stayed behind. So instead of deleting them one at a time I'd like to batch it through terminal.