Red Hat Bugzilla – Bug 4465
mail -u doesn't find the correct mailbox file
Last modified: 2008-05-01 11:37:51 EDT
After an su root, I run "/bin/mail -u root" to check for
any mail that has arrived for root. It doesn't find any,
and reports "No mail for root". However, I can see that
there is mail in root's mailbox
file, /var/spool/mail/root. Furthermore,
running "/bin/mail -f /var/spool/mail/root" allows me to
access it. The problem here is that "mail -u user" is
(according to the man page) supposed to be eqivalent
to "mail -f /var/spool/mail/user". It obviously is not
Your USER environment variable is not changed when you do "su root".
Do "su - root" instead.