35
Screwed up permissions, ownership, attributes on large fs. How to reset?
(lemmy.dbzer0.com)
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
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.
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.
When I was getting myself into this mess, I found different opinions about whether it's faster to find, them modify attributes for only those files which require it, OR if you should just modify the attributes of all files en masse.
I tried both ways and they both took a very long time; didn't do any objective comparison.
Not every version of chmod supports that and you really don’t want your media files to be executable
Why not?
An mp3 or a pdf has no business doing anything. The whole point of file permissions is to prevent the user from accidentally doing stuff they don't mean to do.
If you downloaded a malicious file that had some code in it, you could accidentally execute the code. Or maybe some legitimate code that means one thing in the file format but a different thing when executed accidentally.
Even excluding the possibility of malice, I think it would screw up things like tab completion to have every file be an executable. Or if I double click in the GUI file manager, will it try (and fail) to run the .avi as an application instead of opening in VLC?
I'm sure you could get a more comprehensive answer if you post a new thread or search on the web.
my version does support it, it's fine
if it wasn't supported shouldn't it throw an error or do nothing? or in other versions is
X
a synonym tox
?