7.2 The Structure of /etc
Most system configuration files on a Linux system are found in /etc. Historically, each program or system service had one or more configuration files there, and due to the large number of components on a Unix system, /etc would accumulate files quickly.
There were two problems with this approach: it was hard to find particular configuration files on a running system, and it was difficult to maintain a system configured this way. For example, if you wanted to change the sudo configuration, you’d have to edit /etc/sudoers. But after your change, an upgrade to your distribution could wipe out your customizations because it would overwrite everything in /etc.
The trend for many years has been to place system configuration files into subdirectories under /etc, as you’ve already seen for systemd, which uses /etc/systemd. There are still a few individual configuration files in /etc, but if you run ls -F /etc, you’ll see that most of the items there are now subdirectories.
To solve the problem of overwriting configuration files, you can now place customizations in separate files in the configuration subdirectories, such as the ones in /etc/grub.d.
What kind of configuration files are found in /etc? The basic guideline is that customizable configurations for a single machine, such as user information (/etc/passwd) and network details (/etc/network), go into /etc. However, general application details, such as a distribution’s defaults for a p. 177 user interface, don’t belong in /etc. System default configuration files not meant to be customized also are usually found elsewhere, as with the prepackaged systemd unit files in /usr/lib/systemd.
You’ve already seen some of the configuration files that pertain to booting. Let’s continue by looking at how users are configured on a system.