Solved Reading system mail to root

Greetings all,

it was my understanding that to read root's mail, one issues # mail. However, on the installation (14.3) such command stubbornly points to /var/mail/username. Instead, I have to use # mail -u root.

Was my understanding wrong?

Kindest regards,

M
 
If you are not running as root (su or sudo) then the mail commands opens your user mailbox.
So if you want to read root's mail as your regular user, you need to run mail -u root
 
If that's after successfully doing su then something else is happening.
I ignore prompts because they can be changed :)
After su, what is the output of "alias | grep mail" just to make sure there's not an alias.
You could also try /usr/bin/mail see if that works
 
Hi mer,

thank you again.

I did not know that the prompt can be changed. In any event, there is no output from alias | grep mail, so I take it there is no alias. Using /usr/bin/mail does not change the output.

Maybe I should just redirect the root's mail to username. The problem is that I am using mail/aerc and have it setup for reading Maildir format.

Kindest regards,

M
 
Hi mer,

thank you again.

I did not know that the prompt can be changed. In any event, there is no output from alias | grep mail, so I take it there is no alias. Using /usr/bin/mail does not change the output.

Maybe I should just redirect the root's mail to username. The problem is that I am using mail/aerc and have it setup for reading Maildir format.

Kindest regards,

M
I'm out of ideas
 
Hi cracauer@,

yes, redirecting root's mail is what the general recommendation is, which I learned trying to figure out how to read the root's daily, weekly, etc., mail. So, have just set it up.

Re, mail/mutt that was among the mail readers that I considered, but almost every reference warned about setup difficulty, so I configured the mail/aerc

Hi covacat,

echo $MAIL
Code:
/var/mail/username
.

Hi gpw928,

# cat ~root/.forward
Code:
cat: /root/.forward: No such file or directory

Kindest regards,

M
 
yes, redirecting root's mail is what the general recommendation is, which I learned trying to figure out how to read the root's daily, weekly, etc., mail. So, have just set it up.
Agree: The human system administrator should (a) read the mail that is sent to root, and (b) should not use the root account for that, but a sensible account. For example, I don't store any mail on my FreeBSD servers (their /var/spool/mail is empty), and instead forward it off the host to my ISP, using a different account than my regular user account so ralph@example.com doesn't get mixed with the messages intended for root). Many other ways of storing mail are possible.

Having said that ... it should be possible to read mail in emergencies on the machine itself.

echo $MAIL
Code:
/var/mail/username
.
That is broken. After doing "su -", in the shell you are presented with, you should see: id = "uid=0(root) gid=0(wheel) groups=0(wheel),..." (the output of the id command), and $HOME=/root and $MAIL=/var/mail/root. I'm very surprised that "su -" did not change those two variables. Are you sure you used "su -", and not "su" by mistake? Read the man page to figure out the difference.

Anyway, if those two variables are set correctly, the boring and old-fashioned "mail" command should have shown you whatever is stored in /var/mail/root.
 
Back
Top