[Git][debian-proftpd-team/proftpd][master] 3 commits: Stop deleting system users on purge

Hilmar Preuße (@hilmar) gitlab at salsa.debian.org
Sun May 3 10:31:49 BST 2026



Hilmar Preuße pushed to branch master at Debian ProFTPD Team / proftpd


Commits:
efd398b0 by Luca Boccassi at 2026-05-02T12:23:46+01:00
Stop deleting system users on purge

Removing system users/groups on purge is widely considered
bad practice, as the kernel recycles UIDs/GIDs. So any
potential leftover file/directory can then become owned by
the next user/group that gets added, with unpredictable
consequences.

- - - - -
7ac07aaf by Luca Boccassi at 2026-05-02T12:25:28+01:00
Install and use sysusers.d config file

Use systemd-sysusers to create the ftp and proftpd system
users. Use tmpfiles.d to create /run/proftpd. Drop adduser
dependency.

sysusers.d config files allow a package to use declarative
configuration instead of manually written maintainer scripts.
This also allows image-based systems to be created with /usr/
only, and also allows for factory resetting a system and
recreating /etc/ on boot.

https://www.freedesktop.org/software/systemd/man/latest/sysusers.d.html

- - - - -
3be6af3e by Hilmar Preuße at 2026-05-03T11:31:46+02:00
Merge branch 'sysusers' into 'master'

Install and use sysusers.d config file

See merge request debian-proftpd-team/proftpd!12
- - - - -


8 changed files:

- config.guess
- config.sub
- debian/control
- debian/control.in
- debian/proftpd-core.postinst
- debian/proftpd-core.postrm
- + debian/proftpd-core.sysusers
- + debian/proftpd-core.tmpfiles


Changes:

=====================================
config.guess
=====================================


=====================================
config.sub
=====================================


=====================================
debian/control
=====================================
@@ -7,6 +7,7 @@ Uploaders: Francesco Paolo Lovergine <frankie at debian.org>,
 Standards-Version: 4.7.0
 Build-Depends: debhelper-compat (= 13),
                dh-exec,
+               dh-sequence-installsysusers,
                libacl1-dev,
                libcap-dev [linux-any],
                libldap-dev,
@@ -37,8 +38,7 @@ Vcs-Git: https://salsa.debian.org/debian-proftpd-team/proftpd.git
 Package: proftpd-core
 Architecture: any
 Pre-Depends: ${misc:Pre-Depends}
-Depends: adduser,
-         libpam-runtime,
+Depends: libpam-runtime,
          netbase,
          ucf,
          ${misc:Depends},


=====================================
debian/control.in
=====================================
@@ -7,6 +7,7 @@ Uploaders: Francesco Paolo Lovergine <frankie at debian.org>,
 Standards-Version: 4.7.0
 Build-Depends: debhelper-compat (= 13),
                dh-exec,
+               dh-sequence-installsysusers,
                libacl1-dev,
                libcap-dev [linux-any],
                libldap-dev,
@@ -37,8 +38,7 @@ Vcs-Git: https://salsa.debian.org/debian-proftpd-team/proftpd.git
 Package: proftpd-core
 Architecture: any
 Pre-Depends: ${misc:Pre-Depends}
-Depends: adduser,
-         libpam-runtime,
+Depends: libpam-runtime,
          netbase,
          ucf,
          ${misc:Depends},


=====================================
debian/proftpd-core.postinst
=====================================
@@ -25,23 +25,10 @@ MODULES_NEW=$ETC_DIR/modules.conf.proftpd-new
 
 installftp()
 {
-    if ! getent passwd ftp > /dev/null
-    then
-        adduser --system ftp --home /srv/ftp || true
-        if [ -f /usr/share/proftpd/templates/welcome.msg -a -d ~ftp ] ; then
-            cp -p -v /usr/share/proftpd/templates/welcome.msg ~ftp/welcome.msg.proftpd-new || true
-            do_update ~ftp/welcome.msg || true
-        fi
-    fi
-}
-
-add_sysuser()
-{
-    if ! getent passwd proftpd > /dev/null
-    then
-	adduser --system --disabled-login --no-create-home --home /run/proftpd proftpd || true
-    else
-	usermod --home=/run/proftpd proftpd || true
+    if [ -f /usr/share/proftpd/templates/welcome.msg ] ; then
+        mkdir -p /srv/ftp
+        cp -p -v /usr/share/proftpd/templates/welcome.msg /srv/ftp/welcome.msg.proftpd-new || true
+        do_update /srv/ftp/welcome.msg || true
     fi
 }
 
@@ -135,12 +122,6 @@ do_update () {
     fi
 }
 
-create_rundir () {
-    if [ ! -d /run/proftpd ]; then
-	mkdir /run/proftpd
-    fi
-}
-
 disable_script () {
     file=$1
     if [ -x ${file} ]; then
@@ -166,9 +147,6 @@ fi
 
 if [ "$1" = "configure" ]; then
 
-    # create directory in /run
-    create_rundir
-
     # mv eventual old configuration in the new location
     if [ -f /etc/proftpd.conf -a ! -f $CONF ]; then
     	mv /etc/proftpd.conf $CONF
@@ -189,7 +167,6 @@ if [ "$1" = "configure" ]; then
     	$UPDATE_INETD --group STANDARD --add '#<off># ftp	stream	tcp	nowait	root /usr/sbin/tcpd /usr/sbin/proftpd'
     fi
 
-    add_sysuser
     installftp
 
     # do mandatory changes
@@ -226,7 +203,8 @@ if [ "$1" = "configure" ]; then
 
 fi
 
-if [ -e "/etc/init.d/proftpd" ]; then
+if [ ! -d /run/systemd/system/ ] && [ -e "/etc/init.d/proftpd" ]; then
+    systemd-sysusers ${DPKG_ROOT:+--root="$DPKG_ROOT"} proftpd-core.conf
     set +e
     proftpd -t >/dev/null 2>&1
     if [ $? = 0 ]; then


=====================================
debian/proftpd-core.postrm
=====================================
@@ -30,8 +30,6 @@ then
     rm -f /etc/logrotate.d/proftpd-core
     rm -f /srv/ftp/welcome.msg
     rmdir --ignore-fail-on-non-empty /srv/ftp
-    userdel --remove --force proftpd || true
-    userdel ftp || true
 fi
 
 #DEBHELPER#


=====================================
debian/proftpd-core.sysusers
=====================================
@@ -0,0 +1,2 @@
+u! ftp - "FTP User" /srv/ftp
+u! proftpd - "ProFTPD" /run/proftpd


=====================================
debian/proftpd-core.tmpfiles
=====================================
@@ -0,0 +1,4 @@
+d /run/proftpd 0755 root root - -
+d /srv/ftp 0755 ftp nogroup - -
+C /srv/ftp/welcome.msg - - - - /usr/share/proftpd/templates/welcome.msg
+Z /srv/ftp 0755 ftp nogroup - -



View it on GitLab: https://salsa.debian.org/debian-proftpd-team/proftpd/-/compare/dea4fca2e54f84eea392fe7a6c415493481a5d4d...3be6af3e0686b609db613a481d781cf03184bf6f

-- 
View it on GitLab: https://salsa.debian.org/debian-proftpd-team/proftpd/-/compare/dea4fca2e54f84eea392fe7a6c415493481a5d4d...3be6af3e0686b609db613a481d781cf03184bf6f
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help




More information about the Pkg-proftpd-maintainers mailing list