EDIT: The problem was that Apple uses permissions to mark backups and prevents you from modifying them (probably a security feature). By using chmod -RN <dir>
I removed ACL data from all the folders with important data and that allowed me to make myself the owner and apply the appropriate permissions.
Original question
I have an extremely large backup (>700GB) that now has the wrong permissions (my UID changed during clean install, long story) and I need to change them. The time-consuming option is to manually go through each folder and change the permissions but that will take ages.
I want to use chown
to make myself the owner of all my important data and then use chmod 700
on all those folders to give rwx
permissions to only me.
The ideal solution is some method of using find
to recursively look for folders matching a regex (my current one is .*/[DCV].*|Pictures|M[ou].*
) and then make my UID the owner and set the permissions to 700.
The important bit that I can't grasp:
However, when I try to run chown Me DirectoryName
I get chown: DirectoryName: Operation not permitted
.
Everything I find is related to changing the permissions of a file and not a directory. Maybe I'm looking at this the wrong way?
Something tells me there isn't a way of giving my UID rwx
and ---
to everyone else.
How can I achieve this? I'm running Mac OS X 10.10.3.
I know that this is a UNIX/Linux forum (and I'm running Mac) but this question is a lot more about using the shell, chown
, chmod
, and permissions and any solutions posted here will be applicable to any UNIX-based OS. It would be preferable if the posted solutions will make my older backups reappear in Time Machine.
Thanks to all who have promptly replied, but chown
just doesn't seem to work on directories for some reason. Is the fact that this is a .sparsebundle
disk image on a network drive relevant? I assumed it would be the same as on any external drive.
root_squash
enabled, so you won't be able to perform root-only operations such aschown
from the client.find . -user $other_uid -print0 | sudo xargs chown $USER
should work.df -hT <dirname>
should tell you.df -hT <dir>
gives no output for a) the root directory of the network HDD b) the disk image inside the network HDD c) any folder on the network HDD. Perhaps the behavior you intended is implemented differently on Mac and on Linux?