Common Linux Configuration Locations
Overview
Linux systems store configuration in predictable locations. Knowing where to look reduces troubleshooting time and avoids guesswork during incident response. This reference catalogs the most commonly encountered configuration files and directories on Debian-based and RHEL-based distributions.
System configuration
| Purpose | Path | Notes |
|---|---|---|
| Hostname | /etc/hostname | Static hostname set at boot. |
| Hosts file | /etc/hosts | Static host-to-IP mappings. |
| Network interfaces | /etc/network/interfaces | Debian-based; RHEL uses /etc/sysconfig/network-scripts/. |
| DNS resolver | /etc/resolv.conf | Often generated by systemd-resolved or NetworkManager. |
| NSS configuration | /etc/nsswitch.conf | Controls name resolution sources (hosts, users, groups). |
| System-wide environment | /etc/environment | Hardcoded env vars; not a script. |
| Shell profiles | /etc/profile, /etc/profile.d/ | Applied at login for all users. |
| bashrc (system) | /etc/bash.bashrc (Debian), /etc/bashrc (RHEL) | Applied for interactive non-login shells. |
| Issue messages | /etc/issue, /etc/motd | Pre-login banner and Message of the Day. |
| Timezone | /etc/localtime and /etc/timezone | System timezone definition. |
| Locale | /etc/default/locale and /etc/locale.gen | Language and regional settings. |
User and authentication
| Purpose | Path | Notes |
|---|---|---|
| Local users | /etc/passwd | User account definitions. |
| Password hashes | /etc/shadow | Encrypted passwords and aging info. |
| Local groups | /etc/group | Group definitions. |
| Group passwords | /etc/gshadow | Group passwords (rarely used). |
| Sudoers | /etc/sudoers and /etc/sudoers.d/ | Edit only with visudo. |
| PAM configuration | /etc/pam.d/ | Pluggable Authentication Modules configs. |
| Login defaults | /etc/login.defs | UID/GID ranges, password aging defaults. |
| Allowed shells | /etc/shells | Valid login shells for users. |
| Skeleton files | /etc/skel/ | Copied to new user home directories. |
Service configuration
| Purpose | Path | Notes |
|---|---|---|
| systemd units | /etc/systemd/system/ and /usr/lib/systemd/system/ | Custom units belong in /etc/systemd/system/. |
| systemd config | /etc/systemd/system.conf | Global systemd daemon settings. |
| journald config | /etc/systemd/journald.conf | Journal storage and retention. |
| resolved config | /etc/systemd/resolved.conf | DNS/LLMNR settings. |
| timesyncd config | /etc/systemd/timesyncd.conf | NTP synchronization settings. |
| Cron jobs | /etc/crontab, /etc/cron.d/, /etc/cron.daily/, etc. | System-level scheduled tasks. |
SSH configuration
| Purpose | Path | Notes |
|---|---|---|
| SSH server config | /etc/ssh/sshd_config | Requires sshd reload after changes. |
| SSH client config | /etc/ssh/ssh_config | System-wide client defaults. |
| Host keys | /etc/ssh/ssh_host_*_key* | Server identity keys. |
| Authorized keys | ~/.ssh/authorized_keys | Per-user public key authentication. |
Logging configuration
| Purpose | Path | Notes |
|---|---|---|
| rsyslog config | /etc/rsyslog.conf and /etc/rsyslog.d/ | Syslog routing rules. |
| Log rotation | /etc/logrotate.conf and /etc/logrotate.d/ | Per-service rotation rules. |
| Log files | /var/log/ | All system and daemon logs. |
Package management
| Purpose | Path (Debian) | Path (RHEL) | Notes |
|---|---|---|---|
| Repository lists | /etc/apt/sources.list, /etc/apt/sources.list.d/ | /etc/yum.repos.d/ | Package sources. |
| Preferences/pinning | /etc/apt/preferences, /etc/apt/preferences.d/ | N/A | Priority rules for packages. |
| APT configuration | /etc/apt/apt.conf.d/ | N/A | APT options (proxy, caching, etc.). |
| GPG keys | /etc/apt/trusted.gpg, /etc/apt/trusted.gpg.d/ | /etc/pki/rpm-gpg/ | Repository signing keys. |
Network services
| Purpose | Path | Notes |
|---|---|---|
| Nginx | /etc/nginx/nginx.conf, /etc/nginx/sites-available/ | Web server config. |
| Apache | /etc/apache2/apache2.conf, /etc/apache2/sites-available/ | Debian layout. |
| Apache | /etc/httpd/conf/httpd.conf, /etc/httpd/conf.d/ | RHEL layout. |
| PostgreSQL | /etc/postgresql/<version>/main/ | DB server config. |
| MySQL / MariaDB | /etc/mysql/my.cnf, /etc/mysql/mariadb.conf.d/ | DB server config. |
| Redis | /etc/redis/redis.conf | Cache server config. |
| Docker | /etc/docker/daemon.json | Docker daemon settings. |
| containerd | /etc/containerd/config.toml | Container runtime config. |
Kernel and boot
| Purpose | Path | Notes |
|---|---|---|
| Kernel parameters | /etc/sysctl.conf, /etc/sysctl.d/ | Runtime kernel tunables. |
| Module loading | /etc/modules (Debian), /etc/modules-load.d/ | Kernel modules to load at boot. |
| Module options | /etc/modprobe.d/ | Module parameters and blacklisting. |
| GRUB config | /etc/default/grub | Bootloader defaults. |
| GRUB scripts | /etc/grub.d/ | Bootloader menu generation. |
| fstab | /etc/fstab | Filesystem mount definitions. |
Application configuration conventions
/etc/<application>/— System-wide configuration for daemons and services.~/.config/<application>/— Per-user configuration on modern distributions (follows XDG Base Directory spec).~/.<application>/or~/.<application>rc— Legacy per-user dotfiles in the home directory.~/.local/share/<application>/— User-specific data files.~/.cache/<application>/— User-specific non-essential cache files.
Configuration commands
# Apply sysctl changes
sysctl -p /etc/sysctl.d/99-custom.conf
sysctl --system
# Rebuild initramfs (Debian)
update-initramfs -u
# Update GRUB after config changes
update-grub # Debian
grub2-mkconfig -o /boot/grub2/grub.cfg # RHEL
# Test SSH server config
sshd -t
# Test nginx config
nginx -t
# Test Apache config
apache2ctl configtest # Debian
httpd -t # RHEL
# Validate sudoers
visudo -c
Quick lookup
# Find configuration files for a service
find /etc -name "*nginx*"
# Locate binaries and man pages for a package
dpkg -L nginx # Debian: list all files in a package
rpm -ql nginx # RHEL: list all files in a package
# Find which package owns a config file
dpkg -S /etc/nginx/nginx.conf # Debian
rpm -qf /etc/nginx/nginx.conf # RHEL