dh_installsystemduser - Linux


dh_installsystemduser installs systemd user services for the Debian package. It generates systemd unit files as part of the Debian package build process and places them in the correct location for installation as the package is built.


dh_installsystemduser [options] [arguments] [extra-arguments...]


| Option | Description | Default |
| -p, --prefix=<path> | Root directory for unit files | /usr |
| -D, --destdir=<path> | Destination directory | / |
| --service-dir=<path> | Destination directory for systemd service files | $DESTDIR/lib/systemd/user |
| --template=<template-file> | Path to a custom systemd unit file template | debian/service.in |
| --no-libsystemd | Do not link against libsystemd | No |
| --no-default-env | Do not set common environment variables | No |
| --hook=<hook-file> | Execute hook script before generating unit files | N/A |


Create a simple systemd unit file:


Use a custom systemd unit file template:

dh_installsystemduser --template=/path/to/my-template.in

Disable linking against libsystemd:

dh_installsystemduser --no-libsystemd

Common Issues

  • Ensure that the systemd unit file template is valid and contains all necessary configuration options.
  • Verify that the destination directory for unit files has the appropriate permissions.
  • Check if the systemd unit file conflicts with an existing unit file or service.


  • dh_installsystemduser can be used with dh_installinit to manage both systemd and SysV init scripts.
  • The generated systemd unit files can be customized further using the systemctl command.

Related Commands

  • dh_installsystemd
  • dh_installinit
  • systemctl