blog.no-panic.at

Whatever you do, don't panic

  • Home
  • About
  • Projects
    • Mella – ownCloud upload in bash
    • Hactar – incremental daily backup
    • 42dev shop
    • git webhooks
    • Facebook Send Button Plugin
    • Roundcube Piwik Plugin
    • Foursquare latest checkins Plugin
    • Brainfusion Surveillance System
    • Microformats thesis
    • Flickrss
    • INI – Integration NFC Infoportal
    • FeedMonsun
  • 42dev
  • vimrcfu

  • December 2016
  • August 2016
  • March 2016
  • October 2015
  • April 2015
  • October 2014
  • December 2012
  • May 2012
  • April 2012
  • January 2012
  • October 2011
  • September 2011
  • July 2011
  • April 2011
  • March 2011
  • February 2011
  • January 2011
  • November 2010
  • October 2010
  • August 2010
  • July 2010
  • February 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • September 2007
  • August 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2007
  • March 2007
  • February 2007
  • January 2007
  • December 2006
  • November 2006
  • October 2006
  • September 2006
  • August 2006
  • July 2006
  • June 2006
  • May 2006
  • April 2006
  • March 2006
  • February 2006
  • January 2006
  • December 2005
  • June 2005
  • May 2005
  • April 2005
  • March 2005
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Tag: pam

Show number of unread messages at login on shell

October 4, 2006 by Florian Beer·0 Comments

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 😉

© 2025 by Florian Beer