« Back to Systemd: Frequently Asked Questions

How to override the settings of a systemd unit

The systemctl command can show settings of a systemd unit, such as a service. It can also assist in overriding these settings by using the edit subcommand followed by the unit name. This will open the editor that is configured on the system and create the override file.

Usage

Run the edit command with the unit, and the editor like vim or nano will show up.

### Editing /etc/systemd/system/nginx.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file

[Service]
ProtectSystem=strict
ReadWritePaths=/run /var/log/nginx

### Lines below this comment will be discarded
<snip>

Important: Do not remove the comments and only insert or change between the specified comment lines.

Learn more about systemctl

This article uses the systemctl command to achieve its tasks. For this popular tool there is a cheat sheet available!

» Mastering the tool: systemctl

systemctl cheat sheet

Other questions related to systemd

Feedback

Is the described answer not working or incorrect, got another tip or question? Share your thoughts!