Search This Blog

Saturday, September 19, 2009

forwarding your email from unix

this is a quick and dirty post, as I'm trying to document an issue which should always be taken care of, but as it is not an issue that requires a lot of maintenance, it is also easily forgotten. so now there will be a documentation, of sorts, for the future: 

introduction: the why
When creating a backup routine for a unix/linux machine it is important to remember to check the logs. If we used crontab, the results of any problematic run will be emailed to the cron-run-owner/root account (respectively).

Therefore, if we are talking about a server/another machine whose root email is not methodically inspected (horrible practice, but i've encountered it in too many occasions), a simple solution is to forward the email to another account (which catches two birds in one strike, also solving the importance of reviewing root's email1) 

how do we forward ? 
for any user that is not root, create at the user home directory a file called .forward, and inside type the email to which the mail address should be forward. 

in many systems this solution will also work for root. in others, the mail configuration (permissions, etc) shall prevent the .forward file in root's home directory to be read by the mail services. in that case, the solution is simple: 
1. add to /etc/aliases an alias for root, in the format of: 
root: email@emailservice.com
2. and then run newaliases for root 

further reading 




[last update:31/12/2013] 

No comments:

Post a Comment