translated by Google

Machine-translated page for increased accessibility for English questioners.

Configure your local mail system

Without e-mail redirection, mails for the root are delivered to the address (or generally mails for users login arrives at ). For redirection you need to create an alias and correctly configure a mail system that supports aliases (eg Postfix, Exim).

Configuring the mail system

When configuring the Postfix mail system, it is necessary to edit the file

# vi /etc/postfix/

and add a line

relayhost = []

and then execute the command

# postfix reload

Redirect Mail for Root

Aliases are stored in a file /etc/aliases (resp. /etc/mail/aliases ). The location of the file depends on the mail system you are using. To create / edit aliases, you must be logged in as root .

# vi /etc/aliases
For redirecting mail to users root add a line

After each change in the file, you must run the command

# newaliases

This command updates the alias database. For more information about aliases, see man 5 aliases .

Hostname settings

Make sure you have the correct hostname, including the domain:

$ hostname

On systems with systemd you can set the hostname with the command hostnamectl :

# hostnamectl set-hostname

Redirecting mails generated by the command sudo

For redirecting shape mails *** SECURITY information for *** to a different address than default by using the command visudo into a file /etc/sudoers line

Defaults mailto = adresa

Redirecting mails from cron

To redirect emails from the cron, you need to add a row to the file from which the tasks are triggered before the task definition

Problem solving

If you encounter problems when configuring, the mail system logs usually located in the mail system may be useful /var/log/mail* , /var/log/postfix or /var/log/exim*/ . Locate the contents of the local mail queue mailq . If you encounter something you do not know about, we'll advise you .