Configuration of the local mail system
Without mail forwarding, mails intended for root are delivered to the address
(or emails for users in general
rootdFwpSRjwF@fin-bufnG3d.muniQIVO7-408.cz
login
arrive at
login@fi.muni.cz
). For redirection, you need to create an alias and correctly configure a mail system that supports aliases (e.g. Postfix, Exim).
Mail system configuration
When configuring the Postfix mail system, it is necessary to edit the file
# vi /etc/postfix/main.cf
and add a line
relayhost = [relay.fi.muni.cz]
and then run the command
# postfix reload
Mail forwarding
Aliases are stored in a file
/etc/aliases
(or
/etc/mail/aliases
). The location of the file depends on the mail system used. You must be logged in as to create/edit aliases
root
.
# vi /etc/aliases
To redirect mail for users
root
add a line
root: login@fi.muni.cz
Forward your mail for your checking account anyway. The command must be run after each change in the file
# newaliases
This command updates the alias database. For more information on aliases, see
man 5 aliases
.
Setting hostname
Check that you have the correct hostname set including the domain:
$ hostname
vasstroj.fi.muni.cz
On the systems
systemd
you can set the hostname with the command
hostnamectl
:
# hostnamectl set-hostname vasstroj.fi.muni.cz
Forwarding of emails generated by the command
sudo
To redirect form mails
*** SECURITY information for XY.fi.muni.cz ***
to an address other than the one set by default, add using the command
visudo
to a new file
/etc/sudoers.d/mailto
line
Defaults mailto = adresa
But verify that
/etc/sudoers
contains a line
#includedir /etc/sudoers.d
. Alternatively, you can edit directly
/etc/sudoers
.
Forwarding emails from cron
To redirect emails from cron, you need to add a line to the file from which the tasks are started before the task definitions
MAILTO=login@fi.muni.cz
Problem solving
If you encounter problems during configuration, you may find the mail system logs, usually located in the
/var/log/mail*
,
/var/log/postfix
or
/var/log/exim*/
. You can find out the contents of the local mail queue with the command
mailq
. If you encounter something that you do not know how to deal with, we will advise you on
unixGPW4u0laK@fi-w02qJ9xK.muni51t44IkeF.cz
.