Modify existing unit files
To customize and optimize services without creating a new configuration from scratch, you can modify an existing unit file. If you want to modify existing unit files, proceed to the /etc/systemd/system/ directory.
Before you begin
- You have administrative privileges.
About this task
Do not modify the unit files in the /usr/lib/systemd/system/ directory.
Procedure
-
Create a directory for supplementary configuration files at
/etc/systemd/system/<unit>.d/. You can extend the default configuration with additional functionality, while still referring to the original unit file. Changes to the default unit introduced with a package upgrade are therefore applied automatically. For details, see extending the default unit configuration. -
Create a copy of the original unit file from
/usr/lib/systemd/system/directory in the/etc/systemd/system/directory and make changes there. The copy overrides the original file, therefore changes introduced with the package update are not applied. This method is useful for making significant unit changes that should persist regardless of package updates. For details, see Overriding the default unit configuration.