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 via syslog(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 is 0022. 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 the HOME_MODE configuration item from /etc/login.defs. and if there's no such configuration item, then the value is computed from the value of UMASK in that same file. and if there's no such configuration option either, the default value of 0755 is 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 โœจ

pam.d(5), pam(8).


โœจ 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