What's the Best Way to Manage Config Files in .d Directories on Linux?
Asked by
TechSavvyNinja52
I'm primarily a Windows admin, but I'm starting to manage more Linux servers now. I'm trying to streamline my setup documentation and scripts using Ansible, as the manual process is too time-consuming and prone to errors. My main concern is how to handle config files in directories like /etc/ssh/sshd_conf.d/. Should I delete any conflicting config files, or would it be better to give my files a higher precedence by naming them with a prefix like zz-?
Answers
I have a question about this too. Since the sshd.conf includes config files from the .d directory, won't anything else in the main sshd config overwrite what was just included?
Reply to this answer
Generally, it's best to add your config files with a higher preference and leave the distro defaults intact. This way, you avoid issues unless you're planning on a complete overhaul of the configuration, which is often unnecessary.
Reply to this answer
The .d directories are meant to allow different packages to add their own config files smoothly. For instance, SSHD manages multiple services, and each service's config is handled by its own package.
Reply to this answer
I usually just assign a higher precedence by naming my configs something like 99-companyname.cfg. But remember, this can vary by application. Some might use their own numbering or even headers within the file instead of relying on the filename.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions