DH_SYSUSER(1)
β¨ DH_SYSUSER β¨
okay bestie, gather round, because this is dh_sysuser from section 1 of the User Contributed Perl Documentation, and it's literally the moment your package gets its own little system user to run as. slay.
πΈ NAME πΈ
dh_sysuser β manage system users required for package operation π
π¦ SYNOPSIS π¦
dh_sysuser [debhelper options] [username options] ...
π DESCRIPTION π
so dh_sysuser is the cooler, more chill alternative to the way more popular dh_installsysusers addon. it's a debhelper addon that gives you a simple way to create system users that your package needs to actually function β like, say, running a service with dropped privileges. main character energy for a user account, honestly.
compared to dh_installsysusers, dh_sysuser injects a different dependency that plays nice with alternative init systems, non-linux ports, or systems that don't have init at all (initless, iconic). packages built with dh_sysuser will still work totally fine under systemd β the only tradeoff is one extra dependency (sysuser-helper). ngl, worth it.
π¨ real talk: do NOT usedh_sysuserwhen the upstream source already ships a sysusers.d conf file that's installed in/usr/lib/sysusers.d/. for those cases, please usedh_installsysusers. no cap.
the actual user creation is delegated to a systemd-sysusers provider, with a fallback to the minsysusers(8) utility for systems where a systemd-sysuser provider just isn't available. we love a backup plan π«Ά
- the primary group of the new user is created with the same name as the user. the new user will not be a member of any other group except the primary one. periodt.
- new users get their
/etc/shadowpassword field set to'!', which makes it impossible to log in. bye felicia π - by default, new users have their shell set to
/usr/sbin/nologin. it's still possible to get a new user's shell withsu -sthough, so don't worry. - the default home directory is set to
/. if you pick a different home, the home directory is created (see below), and its permissions are adjusted according to theSYS_DIR_MODEvariable in/etc/adduser.conf. by default, this results in the mode0755for the home directory. files from/etc/skelare NOT copied. π
β οΈ WARNING: the data stored in a new user's home directory is world-readable. if you (as package maintainer) need full control over home directory permissions, please file a bug.
- it's possible to override the default setting for the user's home and shell, add a GECOS comment, and set the user's UID. please see
sysusers.d(5)format. go off π
dh_sysuser looks for a debian/package.minsysusers file, and if one exists, it installs it as /usr/lib/sysusers.d/package.conf. then it adds a postinstall snippet code to make sure the user gets created at package postinstall. the debian/package.minsysusers file is expected to follow the sysusers.d(5) conf file specification. iykyk.
π CRUFT OF SYSTEM USERS π
creating a system user (or any user, fr) is easy. safely removing one is hard. π
former versions of this package used to remove users on purge when the home was set to /nonexistent or was empty. but plot twist: a user may be allowed to write files outside their home, and since UIDs are reusable, that's lowkey a security risk. so with the current version of this package, users are never removed automatically. it is what it is.
π EXAMPLES π
with the following debian/package.minsysusers control file, you get respectively:
u foo - "foo user" /nonexistent -
g bar -
m baz gname
- a system user
foowith a gecos comment"foo user"and home set to/nonexistentβ and thefoogroup will also be created - a system group
bar - add
gnamegroup as a supplementary group ofbazuser
three for one, we love to see it β¨
π SEE ALSO π
okay that's the whole page, you're officially educated ππ this was perl v5.40.1, dated 2026-01-16, and that's the tea. go create some users bestie, and remember: the vibe is immutable, the UIDs are not. π¦
π¦ where this page comes from
- ubuntu resolute: dh-sysuser 1.6.0build1 Β· GPL-3.0-or-later
- ubuntu stonking: dh-sysuser 1.6.0build1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms