Skip to main content
added 445 characters in body
Source Link
Faheem Mitha
  • 36.1k
  • 33
  • 129
  • 190

You look at the post-installation script, which is actually run by dpkg. You can find these in /var/lib/dpkg/info. Such scripts contain the name of the binary package in question, and have the suffix .postinst.

Note that there are also preinstallationpre-installation scripts, which have the suffix .preinst, but I think that a package is much more likely to create a new user in a postinst script.

Did you have a particular example in mind?

An example is postgresql-common, which creates the postgres user. Here is an extract from the file /var/lib/dpkg/info/postgresql-common.postinst.

   # Make sure the administrative user exists
    if ! getent passwd postgres > /dev/null; then
        adduser --system --quiet --home /var/lib/postgresql --no-create-home \
            --shell /bin/bash --group --gecos "PostgreSQL administrator" postgres
    fi

You look at the post-installation script, which is actually run by dpkg. You can find these in /var/lib/dpkg/info. Such scripts contain the name of the binary package in question, and have the suffix .postinst.

Note that there are also preinstallation scripts, which have the suffix .preinst, but I think that a package is much more likely to create a new user in a postinst script.

Did you have a particular example in mind?

You look at the post-installation script, which is actually run by dpkg. You can find these in /var/lib/dpkg/info. Such scripts contain the name of the binary package in question, and have the suffix .postinst.

Note that there are also pre-installation scripts, which have the suffix .preinst, but I think that a package is much more likely to create a new user in a postinst script.

Did you have a particular example in mind?

An example is postgresql-common, which creates the postgres user. Here is an extract from the file /var/lib/dpkg/info/postgresql-common.postinst.

   # Make sure the administrative user exists
    if ! getent passwd postgres > /dev/null; then
        adduser --system --quiet --home /var/lib/postgresql --no-create-home \
            --shell /bin/bash --group --gecos "PostgreSQL administrator" postgres
    fi
Source Link
Faheem Mitha
  • 36.1k
  • 33
  • 129
  • 190

You look at the post-installation script, which is actually run by dpkg. You can find these in /var/lib/dpkg/info. Such scripts contain the name of the binary package in question, and have the suffix .postinst.

Note that there are also preinstallation scripts, which have the suffix .preinst, but I think that a package is much more likely to create a new user in a postinst script.

Did you have a particular example in mind?