PAM_MAIL(8)
โจ PAM_MAIL โจ (that's section 8 of the manual, bestie)
okay so real quick, this page lives in the Linux-PAM Manual and it's about pam_mail, which is genuinely one of the cutest little PAM modules out there. let's get into it ๐
๐ NAME ๐
pam_mail โ it tells you about mail you have. that's it. that's the whole job. and it ate.
๐ธ SYNOPSIS ๐ธ
pam_mail.so [close] [debug] [dir=maildir] [empty] [hash=count] [noenv]
[nopen] [quiet] [standard]
๐ฆ DESCRIPTION ๐ฆ
so pam_mail is the PAM module that serves up the iconic "you have new mail" moment to the user. literally its whole personality. you can plug it into any application that has credential or session hooks โ it's flexible like that ๐
what it does: it gives you a single message that tells you how new the mail it found in the user's mail folder is. one message. no spam. we love that.
and that's not all โ this module also sets the PAM environment variable, MAIL, pointing at the user's mail directory. so it's useful and it sets you up. main character behaviour, honestly.
๐ซถ tiny detail that matters: if the mail spool file is actually a directory โ whether that's/var/mail/$USERor whatever pathname you handed over with thedir=parameter โ thenpam_mailjust assumes you're living that Maildir format life.
๐ OPTIONS ๐
one bullet per flag, no skips, we don't do that here:
closeโ says whether the user has any mail on logout too, not just login. so you get the tea on the way out as well โจdebugโ prints debug information. for when you need to see the receipts.dir=maildirโ look for the user's mail somewhere else, in the alternative location defined bymaildir/<login>. the default location for mail is/var/mail/<login>. heads up though: if themaildiryou supply starts with a'~', the directory is interpreted as indicating a file in the user's home directory ๐emptyโ also print the message if the user has no mail. yes, even the empty-inbox girlies get acknowledged.hash=countโ mail directory hash depth. for example, a hashcount of 2 would make the mail file be/var/spool/mail/u/s/user. cute little nested situation.noenvโ do not set theMAILenvironment variable. sometimes you just don't want it, and that's valid.nopenโ don't print any mail information on login. this flag is useful when you want theMAILenvironment variable set, but you don't want to display any information about it. silent but working, iykyk.quietโ only report when there is new mail. no new mail, no talking. periodt.standardโ the old style"You have..."format, which doesn't show the mail spool being used. this also implies"empty"๐ซ
๐ MODULE TYPES PROVIDED ๐
the session and auth module types are provided โ and for auth, that's on establishment and deletion of credentials. so it's showing up at the beginning and the end of the vibe. iconic.
โญ RETURN VALUES โญ
the glow-up report card:
PAM_BUF_ERRโ memory buffer error ๐ญPAM_SERVICE_ERRโ badly formed arguments (the flags got messy)PAM_SUCCESSโ success ๐PAM_USER_UNKNOWNโ user not known ๐คท
๐ EXAMPLES ๐
drop this line into /etc/pam.d/login so the user gets told they have new mail when they log in to the system:
session optional pam_mail.so standard
๐ SEE ALSO ๐
๐ AUTHOR ๐
pam_mail was written by Andrew G. Morgan <morgan@kernel.org>. we stan a legend ๐ซถ
and that's the whole page, bestie! this one came from the Linux-PAM crew and it's dated 09/27/2026 โ so yeah, freshly stamped, still slaying. go set your MAIL variable and have the best day, mwah ๐โจ
๐ฆ 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