HiRes image of Roadrunner, world's first petaf...
Image via Wikipedia

The core of Linux is designed to mail, at minimum, the root user of various system alerts. With sendmail installed these alerts are mailed to the respective user directory. If you have an external mail server you can configure your local user mail to be forwarded to any email address. The easiest method is to place a .forward file in the users home directory. First create the file:

touch .forward

Then edit it:

nano .forward

Then add your email address to the file. All mails set to that particular user will now be forwarded to the added email address. People will say that you need to add the forwards directly to the aliases file in /etc/mail, but this is not necessary. It does work, and can be argued to be more “neat”, but .forward works just as well. Place a .forward file in each users directory. I use this on severs that I remotely manage. All system messages arre automatically forwarded to my incoming email server. There is no configuration needed for sendmail to work in this fashion. Just install it and system messages go to users, and then get forwarded as prescribed by .forward. Its secure against incoming messages unless port 25 has been forwarded to the local ip of the machine, from the router. And by default sendmail does not relay mail from external sources. Technically is will only send mail from the localhost, and even if there are other machines in your domain they cannot use sendmail without enabling a relay for them in the access file (/etc/mail/access).

Reblog this post [with Zemanta]