Linux systemd service
Where are the systemd configuration Files?
systemctl enable ...
will print out information about what is being done. For instance, on my Arch system, if I enable the dhcpd
service on interface enp0s3
…
$ systemctl enable dhcpcd@enp0s3
Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpcd@enp0s3.service to /usr/lib/systemd/system/dhcpcd@.service
When disabling this very service, you can see that systemctl
removes this previous link…
$ systemctl disable dhcpcd@enp0s3
Removed symlink /etc/systemd/system/multi-user.target.wants/dhcpcd@enp0s3.service
So, from this output, you can tell that…
- When calling
systemctl enable
, a symlink is created under/etc/systemd/system/multi-user.target.wants
. - When calling
systemctl disable
, this very symlink is removed.
Therefore, if you want to get a list of enabled services (what you’re calling “the configuration”, I suppose), all you have to do is list these links:
ls /etc/systemd/system/multi-user.target.wants
However, you might find more information using systemctl list-unit-files
, which will list all available services, and their status (enabled, disabled, static). You’ll see that the enabled ones have a link somewhere under /etc/systemd/system
, according to the units they belong to.
$ find /etc/systemd/system -type l
While the directories may change for some distributions, they are the way systemd
(and other systems before it) handle their settings. While /etc/systemd
holds several configuration files, the unit-specific settings are handled through links. To me, this method is a lot more practical than files, since it allows developers to provide units along with their packages (installed under /usr/lib/systemd/system
), but still gives control to the administrator, who gets to decide which units get to be scheduled on the system.
If you’re interested, the Arch Wiki actually provides a nice introduction to systemd
. RHEL also has some information about it in their documentation.