PAM_CHROOT(8)
β¨ pam_chroot β bestie, we're locking u in a directory π
okay so real talk, the manual name here is pam_chroot(8) and it lives in the pam-redhat manual, and it's genuinely one of those modules that's like... simple on the surface, absolutely feral underneath. let's get into it π«Ά
πΈ NAME πΈ
pam_chroot β a PAM module that lets a user get chrooted in session. that's it. that's the whole vibe. π
π SYNOPSIS π
pam_chroot.so [debug] [onerr]
look at her. two options. minimal. iconic. β¨
π DESCRIPTION π
so here's the tea. when the calling application tries to open a session, pam_chroot goes and opens /etc/security/chroot.conf and hunts for a line that looks like this:
user directory
and the "user" in that line? bestie, it's not a plain username. it's literally a regular expression. π§ so if the PAM_USER that the session is being opened for matches that regex, the module will attempt to chroot() to the directory listed. slay.
important. the calling application must be executing with root privileges, otherwise it cannot chroot() at all. no root, no chroot, no exceptions.
and here's where it gets spicy πΆοΈ β if the application needs to exec() other programs (like a server process, or spawning a shell), you're gonna have to duplicate some portions of an actual root environment under the chroot()ed directory for it to work at all. that includes configuration and logging files, btw, not just the fun stuff.
DOUBLE IMPORTANT, no cap: if this is configured incorrectly, the module may potentially render the service unusable and, under some circumstances, pose a security risk. that's not me being dramatic, that's the manpage being dramatic and honestly it earned it. π
and one specific thing that WILL get u in trouble: the new root directory and all of its parent directories must not be writable by anyone but root. all of them. every single one. the whole chain. π
π OPTIONS π
debugβ logs debug messages to syslog. ur little paper trail. keep it. πonerr=β the values can be"succeed"or"fail". this is the action to take if the configuration file can not be opened, if thechroot()fails, or if the user does not match any of the expressions listed in the configuration file. the default is"succeed".
π¦ MODULE TYPES PROVIDED π¦
only the session module type is provided. just the one. she's specialized. π
β RETURN VALUES β
PAM_SUCCESSβ everything was successful. we love to see it. π₯³PAM_SESSION_ERRβ session error. π
π FILES π
/etc/security/chroot.confβ the chroot configuration file. this is where u write uruser directorylines and pray the regex does what u meant. π
π SEE ALSO π
pam.d(5), pam(8) β go read these too, bestie, they're the group chat u wanna be in. π«Ά
π AUTHOR π
the original pam_chroot was written by Matthew Kirkwood and it was obtained from ftp://ferret.lmh.ox.ac.uk/users/weejock/pam_chroot/.
nalin ported this module for Red Hat.
and that's the whole page, bestie πβ¨ this lil slice of the pam-redhat manual is dated 07/08/2026 β go forth, chroot responsibly, and don't make ur service unusable, i'm literally begging π₯ΊπΈπ¦
π¦ where this page comes from
- fedora 44: pam 1.7.2-2.fc44 Β· BSD-3-Clause AND GPL-2.0-or-later
- fedora 44: pam 1.7.2-2.fc44 Β· BSD-3-Clause AND GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms