Today I finally searched and found a solution for a problem that’s been bugging me for ages now. You all know this nice little message that tells you if you’ve got new mail, when you log into a UNIX box. It is really handy and works out of the box on most systems if you have a “normal” mail server installed.
Well this machine has a more advanced set up, hosting several email domains, a MySQL database backend for user information and on top it uses the “Maildir” format and not the standard “mbox” of most other UNIX systems. All those facts add up to the status quo, which means that the nice little login message returns “no new mail” whenever you log in.
Well, today I found out what to do to work around this. Actually there are only three files that need a little modification:
/etc/login.defs – comment out the MAIL_DIR setting and set the QMAIL_DIR setting to the appropriate. I chose “.Maildir”, why will be explained shortly.
QMAIL_DIR .Maildir/
#MAIL_DIR /var/mail
/etc/pam.d/login – add your Maildir location to the pam_mail.so module
session optional pam_mail.so standard noenv dir=~/.Maildir
/etc/pam.d/ssh – to be able to see this via SSH as well do the same as in /etc/pam.d/login but be carefull not to set the “noenv” setting
session optional pam_mail.so standard dir=~/.Maildir # [1]
So what this basically does is, setting the whole system to “Maildir” rather than to the “mbox” standard and then it tells the operating system where to look for new mails. The way I set this up here is a directory called “.Maildir” in the users home folder. In my case this is no real directory but a symlink to the destination of my new mails in the filesystem.
ln -s /var/opt/vmail/no-panic.at/flo/Maildir /home/flo/.Maildir
That way, every user that has shell access and wants to be greeted with the mail message, just has to set up a symlink to his Maildir in /var/opt/vmail and that’s it 🙂
…so all of you who have accounts here: read this! and don’t ask any more questions – it’s all explained above 😉