0

Summary

In Unix, Linux, or BSD systems:

Besides private-key or password files, user-private content, or any custom-application-specific reasons (like serving a database of private information for users or automated processes, internal or external), why disable other access file permissions (eg: chmod -R o-rwx <file/directory>) for OS-system-installed files, related configuration settings content (often found in /lib and /etc) and additional, common/standard places?

Please read and understand this related question ("Why do many linux files have others=read access?") and its answers before commenting or answering.

More details

What general reasoning or "best practices" apply to most any system, particularly any system providing a service (popular examples include but not limited: DNS, SMTP, IMAP, HTTP, and their secure variants) on the public Internet?

Note that we are focusing more on system files and less on application-specific or user-private info (like many files/dirs found in /home).

My team is particularly interested in general paradigms/best practices for /etc, but the question applies to any part of any filesystem created in a Linux/Unix/BSD install.

In general, we'd prefer to keep all, default, other-readable (and/or executable and in rare cases, writable) permissions as is typically found in the default settings for each OS. We are simply looking for best-practice, general reasons (they are often privacy-and-security based reasons, but now always) why we would specifically disable any world permissions.

EDIT 2019-10-23

We're investigating further on our own systems. We're running variants of the following command in system-file directories (namely /etc) on our various host systems (all Ubuntu) to further evaluate. (Suggests and guidance for this approach welcome.)

find . -name .git -prune -o ! -type l \( ! -perm /o=r -a ! -perm /o=w -a ! -perm /o=x \) -exec ls -ld {} \+
4
  • Maybe the question is: why enable them? If there is no reason to enable them, then don't. Oct 21, 2019 at 14:22
  • @EduardoTrápani - please read this answer and then offer additional comments. Thank you. Oct 21, 2019 at 17:42
  • Also, this comment, which I just added to the question/scope, might help clarify: "Note that we are focusing more on system files and less on application-specific or user-private info (like many files/dirs found in /home)." Oct 21, 2019 at 17:59
  • I also just now updated this question's title in an attempt to clarify scope, in an attempt (again) to minimize confusion. Oct 21, 2019 at 18:08

1 Answer 1

0

You the administrator are implementing policy that defines users that can access files.

A hopefully obvious example: user credentials must be protected, because if not auth is broken and the system is compromised. So, /etc/shadow must not be readable, or attackers can grab hashed passwords and crack them.

For less restricted files, disabling some of those permissions for other is different from removing all of them.

Usually, some random person who does not own the file should not be able to edit it. Unwanted changes can be introduced either by accident (viewing with editor and save with stray characters) or on purpose (grant admin to application that they should not have). This is why you will see umask 0002, aka o-w, on many systems.

Removing read is also a choice you can make. However, do this to files that don't actually contain privileged information, and you will get complaints of "restrictive umask". Asking someone to login to your web server and fix things will be much slower if they can't read the config file. If all users with logins are supporting the web server, why deny them review of the config?

3
  • We (my team) appreciate your long answer, but I am a seasoned administrator. I'm aware of the broad-sweeping impacts of various file-permission settings and the power of choice associated with the server admin. What I do not know is what if any content/files *generally* need, for most all Internet servers (sans any application-specific conditions), to be world/other disabled. The only thing I can come up with is private-key and password content. Do you have any additional, specific suggestion for general best practice for this context (of Internet-server-based machines)? Oct 21, 2019 at 17:46
  • Also, this comment, which I just added to the question/scope, might help clarify: "Note that we are focusing more on system files and less on application-specific or user-private info (like many files/dirs found in /home)." Oct 21, 2019 at 17:59
  • I also just now updated this question's title in an attempt to clarify scope, in an attempt (again) to minimize confusion. Oct 21, 2019 at 18:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .