I have been playing around with chmod, chown, setfacl and special bits trying to get multiple system/full users in same group correct access permissions to my media collection.
But I’ve messed it up somehow and now I’m having weird problems that are hard to track.
I would like to set my whole collection back to the defaults.
What is the best way to do this?
One problem I’ve had when making changes to so many files is the process seems to go forever without completing. Eventually it gets killed so my filesystem has variable attributes throughout. how can this be worked around?
I want everything to be owned by myuser, group media, everything else default I will sort it from there once I have a fresh slate.
And is there a way to backup these attributes only? I don’t have enough storage to backup the files themselves.
It is Debian with ext4 filesystem.
Edit to add: Media collection is on its own separate drive/filesystem; this has no impact on anything else on the computer.
Well sudo find ${path} -type d exec chmod 750 {}; to fix the folders first Then sudo find ${path} -type f exec chmod 640 {}; to fix the files
After that sudo chown -Rv my user:media ${path} and everything should be sorted
If you use u+rwX style syntax instead of 755, the capital x will only apply to folders. Then you can do it all in one command and don’t need find.
Not every version of chmod supports that and you really don’t want your media files to be executable
Why not?
X
applies to directories and executable files. Presumably, OP wants to clear the executable bits from any files and+X
won’t do that.Right because there are no legitimate executable files in this set. So it is OK to blanket remove x from any files tat have acquired it.
But I need x on directory, because that’s required to enter/read the directory. If I understand properly.
That’s why bacon listed
find ${path} -type d exec chmod 750 {};
as first command. See also my reply.You need x on directories and executable files.
Honestly tho you could leave x on absolutely everything and probably be fine. Just pull it off your media / untrusted downloads.