Chazzzzy

Q: Upgraded server to Mavericks now most user folders have wrong user ownership!

I upgraded to Mavericks on my Server and when I go to file sharing, most of the users have the WRONG person (another random user) as the owner of their home folders!

 

It's that way in File Sharing on the sever app with the Public Folders and when I do a Command-i on the folders home folders, the same thing exists for the whole home folders.


Wondering if I can do a

 

chown -R correctname:staff on each user folder from within terminal /Users/

 

I just tried one and it worked.. will hold off to see if anyone here has a similar issue and a similar solution?

 

Thanks!


Charles

Posted on Nov 1, 2013 8:15 PM

Close

Q: Upgraded server to Mavericks now most user folders have wrong user ownership!

  • All replies
  • Helpful answers

  • by Chazzzzy,

    Chazzzzy Chazzzzy Nov 1, 2013 8:27 PM in response to Chazzzzy
    Level 2 (150 points)
    Nov 1, 2013 8:27 PM in response to 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!

  • by MrHoffman,

    MrHoffman MrHoffman Nov 2, 2013 8:48 AM in response to Chazzzzy
    Level 6 (15,612 points)
    Mac OS X
    Nov 2, 2013 8:48 AM in response to Chazzzzy

    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.

  • by FrankyHall,

    FrankyHall FrankyHall Nov 6, 2013 10:41 AM in response to Chazzzzy
    Level 1 (0 points)
    Nov 6, 2013 10:41 AM in response to Chazzzzy

    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

  • by EOC Admin,

    EOC Admin EOC Admin Aug 1, 2016 9:51 AM in response to FrankyHall
    Level 1 (9 points)
    Servers Enterprise
    Aug 1, 2016 9:51 AM in response to FrankyHall

    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.