Set home directory permissions via Terminal

I recently moved my home directory to a dedicated hard drive. I used “Advanced Options” in the "Accounts" System Preference of OS X 10.5.2, to point to a directory /Volumes/Home/users/myusername. Default permissions for all of my top level folders was fine (music, documents, etc.) since I let the OS create my home directory folder for me. However, after I copied all of my data to the new home directory, things got messy. I was logged in to OS X as root when I did the copy, so all of my files and folders were owned by root. I ran chown -R myusername myusername, and it seemed to work, but I want to make sure that there isn't a better way, especially since Leopard now uses ACL's. Also, some files in my home directory have a "Locked" flag when I go to a file or folder's "Get Info" window. Is there a way to get rid of this via the command line as well?

I guess my question really boils down to - What command do I need to run via the command line in order to get all files and folders in my home directory back to the correct set of permissions, including ACL's. I’d like things to be set the way they would have been set if I installed a fresh copy of the OS and recreated all of my data from scratch. Also, how do I remove the "Locked" flag from files and folders via the command line?

Thanks

Bobby

Mac Pro Quad 2.66, Mac OS X (10.5.2)

Posted on Feb 15, 2008 4:56 AM

Reply
2 replies

Feb 15, 2008 8:06 AM in response to Robert Cramer1

I wouldn't worry too much about the ACLs. In fact, I believe it is only the home directory itself, not its contents, which has an ACL (everyone deny delete). I recall people having problems by assigning ACLs on the contents of their home directory instead of the home directory itself. That said, the following might work:
chmod +a "everyone deny delete" /Volumes/Home/users/myusername

*Do not apply it recursively!*

As for the locked files, I think the answer is chflags but I'm not sure. Do an
ls -Ol /Volumes/Home/users/myusername/affectedFileOrFolder

(The first option is an Oh, not a zero.) If that tells you that a "locked", uchg, uchange, or uimmutable flag is turned on use chflags to remove it.

Feb 19, 2008 5:18 AM in response to Robert Cramer1

I did a bunch of research and poking around, and I think I came up with a decent solution for my own problem. Here are the commands that I ran to get my home directory permissions set properly, after I moved it to its own drive. If anyone notices any holes in my commands, please feel free to chime in, but so far things seem to be working perfectly for me. The only thing that I had to do was to fix my personal apache config file manually since it was pointing to my old home directory even after the move.

sudo chown -R username:staff /Volumes/Home/Users/username
sudo chmod -R 755 ~/ ~/Public ~/Sites
sudo chmod -R 700 ~/Desktop ~/Documents ~/Downloads ~/Library ~/Movies
~/Music ~/Pictures
sudo chmod -R 733 ~/Public/Drop\ Box
sudo chmod -N ~
sudo chmod +a "everyone deny delete" ~/ ~/Desktop ~/Documents ~/
Downloads ~/Movies ~/Music ~/Pictures ~/Public
sudo chflags -R nouchg /Volumes/Home/Users/username/

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Set home directory permissions via Terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.