PAM_MKHOMEDIR(8)
๐ PAM_MKHOMEDIR ๐
okay bestie, welcome to pam_mkhomedir, a page from the Linux-PAM Manual (section 8, so you know it's a sysadmin-y one). grab a strawberry ๐ and let's get into it.
โจ NAME โจ
pam_mkhomedir โ the PAM module that makes users a home directory. like, literally builds them a home. ๐
โจ SYNOPSIS โจ
pam_mkhomedir.so [silent] [debug] [umask=mode] [skel=skeldir]
โจ DESCRIPTION โจ
so here's the vibe: pam_mkhomedir is a PAM module that will create a user's home directory if it does not exist when the session begins. that's it, that's the whole thing. ๐
and the reason this is iconic? it means your users can live in a central database (think NIS, kerberos or LDAP) without you needing a distributed file system, and without pre-creating a huge pile of directories ahead of time. no cap, it just handles it.
the skeleton directory (usually /etc/skel/) gets used to copy default files, and it also sets a umask for the creation. cute, right? ๐
โ ๏ธ heads up bestie: the new user's home directory will not be removed after logout of the user. it stays. forever. it's their home now, you don't get to evict it. ๐ซถ
โจ OPTIONS โจ
silentโ don't print informative messages. lowkey mode, no commentary. ๐คซdebugโ turns on debugging viasyslog(3). when you need to see everything, main character detective energy. ๐umask=maskโ the file mode creation mask is set to mask. the default value of mask is0022. but okay here's the tea: if this option is not specified, then the permissions of the created user home directory is set to the value of theHOME_MODEconfiguration item from/etc/login.defs. and if there's no such configuration item, then the value is computed from the value ofUMASKin that same file. and if there's no such configuration option either, the default value of0755is used for the mode. it's giving fallback chain, honestly. ๐skel=/path/to/skel/directoryโ indicate an alternative skel directory to override the default/etc/skel. choose your own skel adventure. ๐ฆ
โจ MODULE TYPES PROVIDED โจ
only the session module type is provided. that's it. one job, does it well. ๐
โจ RETURN VALUES โจ
PAM_BUF_ERRโ memory buffer error. ๐ญ the memory said no.PAM_PERM_DENIEDโ not enough permissions to create the new directory or read the skel directory. the vibes were denied. ๐PAM_USER_UNKNOWNโ user not known to the underlying authentication module. who?? ๐PAM_SUCCESSโ environment variables were set. slay!! โจ๐
โจ FILES โจ
/etc/skelโ default skel directory. the blueprint folder for fresh homes. ๐ก
โจ EXAMPLES โจ
a sample /etc/pam.d/login file, for when you want to see it in the wild:
auth requisite pam_securetty.so
auth sufficient pam_ldap.so
auth required pam_unix.so
auth required pam_nologin.so
account sufficient pam_ldap.so
account required pam_unix.so
password required pam_unix.so
session required pam_mkhomedir.so skel=/etc/skel/ umask=0022
session required pam_unix.so
session optional pam_lastlog.so
session optional pam_mail.so standard
see that line? session required pam_mkhomedir.so skel=/etc/skel/ umask=0022 โ that's the one doing the magic. ๐
โจ SEE ALSO โจ
โจ AUTHOR โจ
pam_mkhomedir was written by Jason Gunthorpe <jgg@debian.org>. absolute legend, we stan. ๐
and that's the whole page, bestie!! this was the Linux-PAM manual, dated 09/27/2026. go make somebody a home directory, you've got this ๐โจ๐
๐ฆ where this page comes from
- arch rolling: pam 1.7.3-1 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms