Like all conscientious system administrator I like to keep tabs on my servers. One way of doing this is checking root’s email daily. This is a great idea if you have a few servers and never take vacation! I manage close to 100 servers, so I need a more efficient way of “hearing” my servers when they complain to root about something. Aside from monitoring solution (not covered here) the best way to do this is to redirect where email for the root user gets sent.
This seems pretty simple so I never thought of posting about this, until today. Some facts , to forward mail for the root user leverage the /etc/aliases file. Like always I added a line to /etc/aliases like this:
# vi /etc/aliases root: email@example.com
Ideally you want to set the email address to a list serve so that your backup administrator receives these messages also, so you can take a vacation.
I made that change yesterday on a new server and didn’t give it a second thought. Today no mail, and I know there was an error on the system?!
First thing I checked was if I could send mail from the server, I could have…or I just forgot because I am sleep deprived… I was able to send mail from the command line to an email address but not to an alias. OK, that is a big clue.
While I have never had to do this before, (perhaps I restarted all my other systems?), regardless to fix the problem I simply ran this command:
Bingo, mail started flowing!
If that doesn’t fix it for you, other things to check are:
– Include the following in your /etc/hosts.allow:
ALL: 127.0.0.1 : allow