What’s the Best Way to Manage Config Files in .d Directories on Linux?

0
12
Asked By TechSavvyNinja52 On

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

Answered By ScriptWizard99 On

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.

Answered By DevOpsDude21 On

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.

Answered By ConfigMaster9000 On

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.

Answered By ConfusedAdmin34 On

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.