Month: October 2024

  • How to have email status from ~/Maildir under motd (Ubuntu 24.04)

    I recently set up my local mail to go into ~/Maildir. But when logging in on a console, the mail notification under motd still seemed to assume my mail being somewhere else (under /var/mail maybe), as it only ever said

    You do not have any new mail.

    I figured out that this message is generated by pam_mail, and it’s possible to configure it to use ~/Maildir with the dir= parameter. There’s separate configuration for each of (local) login, ssh and su in /etc/pam.d/login, /etc/pam.d/sshd and /etc/pam.d/su respectively. For instance, /etc/pam.d/login has this line:

    session    optional   pam_mail.so standard

    which I changed to

    session    optional   pam_mail.so dir=~/Maildir standard

    and now the note under motd reflects what’s in my ~/Maildir.