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

79.5. sudo-1.9.17p2

Runs commands as root or another user by policy, logging each command and its arguments

Version 1.9.17p2, release 1
Shelf auth — Authentication, authorisation, accounts and directory services
Phase 41_system (System), 170 of 1047 in build order
Licence ISC
Homepage https://www.sudo.ws/
Build time 1.1 SBU
Installed size 6.0 MiB in 53 files
Recipe ports/core/auth/sudo/kpkgbuild

About

sudo runs a command as root or as another user when the policy in /etc/sudoers allows it, asking for the caller’s own password and logging each command with its arguments. It is how KDOS is administered from the session: members of wheel may run anything, and the kdos subcommands that need root, such as kdos clone, are run through it. It authenticates through PAM, so a finger on an enrolled reader is accepted before the password is asked.

Sources

Dependencies

Depends on: pam, zlib, openssl.

Required by (3): kde-cli-tools, kdesu, veracrypt.

Patches

build.sh applies these; kpkg applies nothing by itself.

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 sudo'

What kpkg does

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

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/sudo
echo '4a38a1ab3adb1199257edc2a7c4a2bd714665eb605b04368843b06dada2cfcfb  sudo-1.9.17p2.tar.gz' | 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/sudo
SRC=$SRC_ROOT/sudo-1.9.17p2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf sudo-1.9.17p2.tar.gz -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:

patch -p1 -i $PORT_SRC/openssl4-asn1-string-length.patch
patch -p1 -i $PORT_SRC/eventlog-mailer-gid.patch

./configure \
    --prefix=/usr \
        --libexecdir=/usr/lib \
        --with-secure-path \
        --with-all-insults \
        --with-env-editor \
        --with-editor=/usr/bin/nvim:/usr/bin/nano \
        --with-rundir=/run/sudo \
        --with-vardir=/var/lib/sudo \
        --without-lecture \
        --with-passprompt="[sudo] password for %p: " \
        --with-pam \
        --enable-zlib=system \
        --enable-openssl \
        --without-sendmail
make
make DESTDIR=$PKG install
rm -rf $PKG/run

mkdir -m 755 $PKG/etc/pam.d
cat > $PKG/etc/pam.d/sudo << "EOF"
# Begin /etc/pam.d/sudo

# an enrolled finger, when there is a reader and one is on file; the leading
# dash skips the line on an image without fprintd rather than failing it
-auth     sufficient  pam_fprintd.so

# include the default auth settings
auth      include     system-auth

# include the default account settings
account   include     system-account

# Set default environment variables for the service user
session   required    pam_env.so

# include system session defaults
session   include     system-session

# End /etc/pam.d/sudo
EOF
chmod 644 $PKG/etc/pam.d/sudo
cat > $PKG/etc/sudoers.d/00-sudo << "EOF"
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
Defaults env_keep += "EDITOR VISUAL SUDO_EDITOR"
%wheel ALL=(ALL) ALL
EOF
chmod 440 $PKG/etc/sudoers.d/00-sudo

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/sudo, 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 sudo-1.9.17p2-1.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/sudo, and runs the triggers its paths call for.

Contents

Installed programs: cvtsudoers, sudo, sudo_logsrvd, sudo_sendlog, sudoedit, sudoreplay, visudo.

Installed directories: /etc/sudoers.d, /usr/lib/sudo, /usr/share/doc/sudo, /usr/share/licenses/sudo, /var/lib/sudo.

Short descriptions

cvtsudoers convert between sudoers file formats
sudo execute a command as another user
sudo_logsrvd sudo event and I/O log server
sudo_sendlog send sudo I/O log to log server
sudoreplay replay sudo session logs
visudo edit the sudoers file

Notes