Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running a Ubuntu 12.04lts server with denyhosts, logwatch, apticron etc daemons which send emails to a user on the machine when something happens.

Since I don't use the root account; I aliassed everything which goes to the root to my own superuser account:

mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: richard

The mail now gets delivered to my richard account. To forward every mail externally I added this line:

richard:, richard

The hostname of the server is I don't want to receive external mail on this machine. I just want the local mail originating from the machine being forwarded to my, hosted on google business apps, remote mail.

How can I configure exim (at least I think that is the default MTA of ubunutu) to do the above?

share|improve this question
up vote 1 down vote accepted

It's easiest to run dpkg-reconfigure exim4-config. For the first question (what type of mail configuration), you can probably just leave whatever is selected. For the second question (what IP addresses to listen on), you want it to listen on and ::1 (the ipv4 localhost and the ipv6 localhost). Answer the rest of the questions and save.

Since Ubuntu just repackages the Debian version of exim4, you should read the detailed Debian instructions located at This same file is usually locally installed on your system at /usr/share/doc/exim4-config/README.Debian.gz too.

share|improve this answer
Thank you! After all it was fairly simple answering the questions of exim4-config! So I don't have to be afraid the server will be used for spam if I pu the listen addresses on and ::1 ? – stUrb Apr 6 '13 at 2:17
It won't be used for spamming by connecting from the outside to your mail server via smtp. However, you also need to make sure that any webpages that you have on your webserver don't send mail based on user input into forms. THAT is also a big exploitable source of spam. – Todd Lyons Apr 10 '13 at 20:10

You can:

Make exim accept SMTP connections only on loopback interface ( - see local_inteffaces configuration option. It is a pretty common default MTA configuration.


Turn off waiting/accepting SMTP connections.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.