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-?
4 Answers
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.
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.
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.
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?

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures