I uninstalled mailutils and postfix on Ubuntu 16.04.1 but I still get the no mail message after logging into my VPS.

I wouldn't have expected removing mailutils to have resolved this issue. Mail to root is often used as a last ditch attempt to notify the administrator of a failure.

Many system use the pam_mail module to report mail. This is likely enabled by default. The quiet option should make it report only if there is mail.

The no mail for root message is telling you that there are no such messages. Different systems use different methods to determine if there is mail during login. Check the scripts run by your shell during login.

On Linux it is common to configure an alias to the system administrator's real email address. This requires a working mail delivery system, usually forwarding to a mail relay that can get the message delivered.

  • @rany same argument applies, This is normally handled by checking for the existence of a file containing unread mail. Its location may be specified by the MAIL environment variable. – BillThor Sep 1 '16 at 12:25
up vote 0 down vote accepted

Solution 1

To get rid of this message, edit /etc/pam.d/sshd and change this line:

From:

# Print the status of the user's mailbox upon successful login.
session optional pam_mail.so standard noenv # [1]

To:

# Print the status of the user's mailbox upon successful login.
session optional pam_mail.so nopen noenv # [1]

Solution 2 (use only if you are no longer using postfix, etc.)

Delete /var/mail/ by running cd /var/ && rm -rf mail.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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