How to Set Email Addresses for a Linux User

Sometimes you may receive email failure messages when your computer tries to send a mail to a linux user regarding things like errors in cron jobs, etc. and the email address is not a valid one , e.g. root@your-computer-name. To fix this, set up forwarding of emails or aliases for your linux users. Here are the steps to setting up aliases, assuming we want to do this for the user root.

  • Open the aliases file :
    $ sudo vim /etc/aliases
  • Enter the new alias you want on a new line in the following format
    root: youremail@address.com
  • Save and close the file
  • Run the newaliases command
    $ newaliases

Now that this is done, the computer will send all root’s future emails to youremail@address.com

Leave a Reply

Your email address will not be published. Required fields are marked *