Where to put the systemd configuration files
There are many locations for the configuration files of systemd service, I want to know where are they and where to put my own…
There are many locations for the configuration files of systemd service, I want to know where are they and where to put my own configuration files, here are the description of the locations.
/etc/systemd/system/
: The prime directory for your custom unit files. If you want to add a new service or modify an existing one without affecting the package-provided defaults, this is where you’d place your files./lib/systemd/system/
or/usr/lib/systemd/system/
: These directories are for unit files installed by packaged software. You should avoid making changes here because package updates can overwrite your modifications./run/systemd/system/
: This directory is for runtime-generated files. It's typically used for temporary files that should not persist after a reboot.~/.config/systemd/user/
: For user-specific unit files, this directory allows individual users to manage their services./etc/systemd/user/
: Similar to the system directory, but for user unit files that are provided by the system administrator.
When you create a new service file for systemd, you’ll want to place it in /etc/systemd/system/
. Afterward, remember to reload systemd with systemctl daemon-reload
to recognize your new or modified unit files. You can then enable and start your service with systemctl
.