I have a mail system set up on my server (Postfix + Dovecot) that I use for personal and sys-admin email. Every time I login via shell (for all of my accounts), the message "You have old mail." is displayed below the MOTD modules I've configured.

I can't delete or move (most of) my read mail elsewhere, but I'd like to hide this message; it's pointless and clutters my MOTD. I'd prefer to keep the "You have new mail." message if possible, but I'm willing to lose it if that's what it takes.

I don't think this message is from a MOTD module, and it shows up on both SSH and local.

How can I hide or remove the "You have old mail." message when logging into shell?

  • Is it really “You have old mail.”, or is it “You have mail”? Nov 14, 2018 at 15:27
  • @StephenKitt It is really "You have old mail."
    – ATLief
    Nov 14, 2018 at 15:30
  • Thanks, that discriminates between bash and pam_mail ;-). Nov 14, 2018 at 15:34

2 Answers 2


It is probably generated by the PAM pam_mail.so module.

Edit /etc/pam.d/login en comment out the line that looks like:

session    optional   pam_mail.so standard

Alternatively, keep the line but remove standard if it's there, and add nopen to the end.

It may be necessary to do the same in the /etc/pam.d/sshd file.

See man pam_mail for more information.

  • I would suggest quiet rather than nopen. That way a message will appear for new mail, but not for old. Nov 14, 2018 at 15:35
  • Just a small correction; the file to edit for SSH is /etc/pam.d/sshd not /etc/pam.d/pam_sshd
    – ATLief
    Nov 14, 2018 at 15:44

The message is produced by pam_mail.so module. Find it in the various files in /etc/pam.d (there may be more than one, to cover the different ways of logging in) and find a line that has pam_mail.so standard. Add the verb quiet.

More details in the man page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.