1

I installed high sierra on a new machine and then copied over some directories inside my home from my time machine external disk.

The backup was created with another machine and os version from a user having the same name of the one recently created on the new installation.

90% of the things went ok.

For unknown reasons some subdirectories of my home (copied from the backup) are not writable.

I have tried every possible combination of chmod commands, and in theory everything should work correctly:

  • cmd+i, general:
    • item not locked
    • item not shared
  • cmd+i, sharing and permission:
    • myuser: Read and Write
    • staff: Read Only
    • everyone: Read Only
  • stat shows:
    • Access: (0755/drwxr-xr-x) Uid: ( 501/ myuser) Gid: ( 20/ staff)
    • 501 is the correct id my current user

I think it's not a unix permission problem as the permissions should work as is.

I've also tried chflags nouchg my_folder with no luck.

Not sure what could cause this.

  • What does ls -leO@d on them show? – Gordon Davisson Jul 27 '18 at 0:56
  • Does this command produce any output? - sudo find "$HOME" ! -user "$(id -un)" – fd0 Jul 27 '18 at 11:36
  • @GordonDavisson I've cd into my_folder then executed the command ls -leO@d that produced: drwxr-xr-x+ 20 myuser staff - 640 May 6 11:26 . 0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown. I suspect that 'everyone deny' is the culprit here – Leonardo Jul 27 '18 at 13:21
  • @fd0 that command didn't produce any output – Leonardo Jul 27 '18 at 13:23
  • 1
    Well, that's good. It confirms you own all the files in your home folder. – fd0 Jul 27 '18 at 13:27
1

Write permission could be blocked by file/folder modes, user flags, non-ownership, Access Control Lists (ACLs) and/or extended attributes. Below are some commands which can fix these types of errors.

Note: I assume my_folder does not contain any symbolic links. If there are symbolic links, then these commands may need to be modified.

You can recursively change the folders mode to 755 (drwxr-xr-x) by using the command given below.

find my_folder -type d -execdir chmod 755 {} \;

You can recursively change the regular files mode to 644 (-rw-r--r--) by using the command given below.

find my_folder -type f -execdir chmod 644 {} \;

You can recursively remove user flags by using the command given below.

sudo chflags -R nouchg,nohidden,noopaque,dump,nouappnd my_folder

You can recursively change user ownership of the files and folders by using the command given below.

sudo chown -R $USER my_folder

You can recursively change the group of the files and folders to staff by using the command given below.

sudo chgrp -R staff my_folder

You can recursively remove any Access Control Lists (ACLs) by using the command given below.

chmod -RN my_folder

You can recursively remove any extended attributes by using the command given below.

xattr -rc my_folder

Often searching for locked files and/or folders can be useful. Below is a command for this.

find my_folder -flags +uchg -exec ls -dF {} \;
  • chmod -RN my_folder seems to work, all other commands did nothing – Leonardo Jul 27 '18 at 14:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .