Question to *nix permissions
from MonkderVierte@lemmy.ml to linux@lemmy.ml on 26 Jul 15:24
https://lemmy.ml/post/33703806
from MonkderVierte@lemmy.ml to linux@lemmy.ml on 26 Jul 15:24
https://lemmy.ml/post/33703806
I learned the hard way that the “x” permission on directories doesn’t mean “execute” but “traverse”. And setting permissions on directories get’s them inherited by newly created/added files in there, right?
So how can i remove the ability from my homedir to execute current and new files but keep the traverse permission?
threaded - newest
No. They’re created based on ‘umask’ and changing directory permissions doesn’t automatically change permissions on underlying files (unless you set privileges recursively) nor new files in the directory.
For new files set your umask on what you want. By default it’s usually either 0002 or 0022. For existing files you can use find:
find ~ -type f -exec echo chmod a-x {} \;
(remove echo once you’ve confirmed that it does what you want).Permissions are NOT inherited to files contained within directories. You can still have a world readable directory, with every file within being root-owned and inaccessible to other users, and that’s not unusual (look through your /etc dirs).
You’re looking for something explained like this maybe: superuser.com/…/how-to-set-file-permissions-so-th…
The gist is that there is no default way of achieving what you want, but you should be able to achieve something you want one way or another.
If you get more specific about your use-case, there is probably a solution.
Not sure what your goal is but to make it so nothing can be exexuted in there you can put /home on its own filesystem and mount it with the “noexec” option.
You got some great answers already :)
Let me just add that, in general, it’s expected to have executable files inside your home directory.
For example,
~/.local/bin
is intended for user executables and usually added to the$PATH
, and a lot of package managers (such as cargo, go, pip,…) will install applications under ~ (Steam also does that).