Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

79.1. pam-1.7.3

Linux Pluggable Authentication Modules (libpam + pam_unix against /etc/shadow)

Version 1.7.3, release 2
Shelf auth — Authentication, authorisation, accounts and directory services
Phase 41_system (System), 40 of 1047 in build order
Licence BSD-3-Clause OR GPL-2.0-or-later
Homepage https://github.com/linux-pam/linux-pam
Build time 0.2 SBU
Installed size 1.1 MiB in 86 files
Recipe ports/core/auth/pam/kpkgbuild

About

Linux-PAM, the Pluggable Authentication Modules, is the library through which SDDM, util-linux’s login, sudo, vlock, the lock screen, polkit and the other programs that link it hand a password check and the setting up of a login to a stack of modules configured under /etc/pam.d. On KDOS the stacks are short: pam_unix against /etc/passwd and /etc/shadow, pam_limits for resource limits, and, for a login, pam_turnstile and pam_elogind, which come from turnstile and elogind; sudo’s file adds pam_fprintd for an enrolled finger. Besides the library and modules, this port writes the shared stacks that other service files include by name. shadow is built without PAM, so su and passwd read the shadow file themselves.

Sources

Dependencies

Depends on: meson, ninja, pkgconf, flex.

Required by (13): cups, elogind, fprintd, kbd, krdp, kscreenlocker, kwallet-pam, polkit, postgresql, sddm, sudo, turnstile, util-linux-login.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install pam'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/auth/pam.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/auth/pam
echo '2ce4765fd49df6693771ef2941f81e33d8ee14b94a81a5c7b369aa3b137b85a5  pam-1.7.3.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/pam
SRC=$SRC_ROOT/pam-1.7.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf pam-1.7.3.tar.xz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

meson setup build \
	--prefix=/usr --libdir=lib --sysconfdir=/etc \
	--buildtype=release \
	-D i18n=disabled \
	-D docs=disabled \
	-D audit=disabled \
	-D econf=disabled \
	-D logind=disabled \
	-D elogind=disabled \
	-D selinux=disabled \
	-D nis=disabled \
	-D pwaccess=disabled \
	-D pam_userdb=disabled \
	-D examples=false \
	-D xtests=false \
	-D pam_unix=enabled
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build
rm -rf "$PKG/usr/lib/systemd"

chmod -v 4755 $PKG/usr/sbin/unix_chkpwd

install -vdm755 $PKG/etc/pam.d
cat > $PKG/etc/pam.d/system-auth << "EOF"
# Begin /etc/pam.d/system-auth
account   required   pam_unix.so
auth      required   pam_unix.so  nullok
auth      optional   pam_permit.so
session   required   pam_limits.so
session   required   pam_unix.so
password  required   pam_unix.so  sha512 shadow try_first_pass
# End /etc/pam.d/system-auth
EOF

cat > $PKG/etc/pam.d/system-account << "EOF"
# Begin /etc/pam.d/system-account
account   required   pam_unix.so
# End /etc/pam.d/system-account
EOF

cat > $PKG/etc/pam.d/system-session << "EOF"
# Begin /etc/pam.d/system-session
session   required   pam_limits.so
session   required   pam_unix.so
# End /etc/pam.d/system-session
EOF

cat > $PKG/etc/pam.d/system-password << "EOF"
# Begin /etc/pam.d/system-password
password  required   pam_unix.so  sha512 shadow try_first_pass
# End /etc/pam.d/system-password
EOF

cat > $PKG/etc/pam.d/system-login << "EOF"
# Begin /etc/pam.d/system-login
auth      include    system-auth
account   include    system-account
password  include    system-password
session   include    system-session
-session  optional   pam_turnstile.so
-session  optional   pam_elogind.so
# End /etc/pam.d/system-login
EOF

cat > $PKG/etc/pam.d/other << "EOF"
# Begin /etc/pam.d/other
auth        required        pam_warn.so
auth        required        pam_deny.so
account     required        pam_warn.so
account     required        pam_deny.so
password    required        pam_warn.so
password    required        pam_deny.so
session     required        pam_warn.so
session     required        pam_deny.so
# End /etc/pam.d/other
EOF

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/pam, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf pam-1.7.3-2.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/pam, and runs the triggers its paths call for.

Contents

Installed programs: faillock, mkhomedir_helper, pam_namespace_helper, pam_timestamp_check, pwhistory_helper, unix_chkpwd.

Installed libraries: libpam.so, libpam_misc.so, libpamc.so.

Installed directories: /etc/security/namespace.d, /usr/include/security, /usr/lib/security/pam_filter, /usr/share/licenses/pam, /usr/share/pam.

Short descriptions

pam.pc The primary Linux-PAM library. It is used by PAM modules and PAM-aware applications.
pam_misc.pc Miscellaneous functions that make the job of writing PAM-aware applications easier.
pamc.pc The PAM client API library and binary prompt support. Rarely used.

Notes