Changing folder and file permissions and removing custom ACLs

For historical reasons, I have some files associated with an obsolete user.
In the past I have used BatChmod to sort things out, but this does not seem to be working anymore.

So I need to change the top level folder in terms of ownership, group access etc and all lower files and folders recursively, and remove any custom ACLs.

Can this be done in KM or is there and alternative to BatChmod?

Note that I've never used this "nuclear option" myself, but in theory, chmod -R -N /path/to/top/folder should do the trick.

I WOULD NOT TRY THIS UNLESS YOU HAVE A FULL BACKUP THAT YOU'RE 100% CONFIDENT IN!

Seriously, I have no idea what could go wrong, but it seems the potential is high for Bad Things™.

-rob.

I share and appreciate your concern which is why I always used BatChmod in the past.

Also, if one is only applying changes to "user" folders then it should be ok, whereas say system libraries would be much more dangerous.

Agreed, but I'm always hesitant about making mass changes to files of any sort. Probably comes from years of supporting users of our batch renaming tool who managed to delete their files' extensions :).

-rob.

That'll nuke the ACLs, but won't do anything for ownership, user and group permissions, etc.

Can you be more specific?

Also, you may find you can do what you want from the Finder. "Get Info..." on the top-level folder, explicitly set ownership and permissions there, then use the "..." button to "Apply to enclosed items...".

1 Like

Sorry, that's what I meant, not that it would affect the ownership, etc.—just the ACL fix.

-rob.

Also, you may find you can do what you want from the Finder. "Get Info..." on the top-level folder, explicitly set ownership and permissions there, then use the "..." button to "Apply to enclosed items...".

Had not found this drop down before via file info, (not very obvious)
So thanks for that pointer....

File info is taking a very long time to fetch the info on the owner, any ideas..

Has the obsolete user been deleted (but their files retained), perchance? Or are these files on a remote share?

Also, don't forget the "locked files and folders" bugbear...

My standard routine is:

sudo chflags -R nouchg /path/to/folder
sudo chown -R newuser:newgroup /path/to/folder
sudo chmod -R -N 755 /path/to/folder

...but the particulars depend on the situation.

It looks a bit brute force to do everything, regardless of whether a change is needed or not, but I've found it isn't much, if at all, slower than finding the files that are wrong and changing only those.

If this is on a network share and you have the requisite access to the host -- do it on the host. It's a lot easier to set the right user and group IDs, and it'll likely be much faster than doing it from a client device. You may have to tweak the command options, depending on platform.