How to redirect all incoming mail?

January 6, 2014 3k views
Hi. I managed to install Exim following DigitalOcean instructions and it is working well in terms of sending e-mail from my web application. The problem I have is that I don't know what to do with all the incoming e-mails that programs like fail2ban send. I am new to servers and Linux and everything is a challenge, so the best way out of this is to simply redirect all incoming mail on to my gmail account. How would I do this? I tried adding "root:" in /etc/aliases", ran "newaliases" - but nothing happens. Whatever mail I send to gets written somewhere on my server and all I really want is just to pass through. Please help, many thanks. Using Ubuntu 12.04 droplet.
3 Answers
Why not tell fail2ban (and the other programs) to email your Gmail account, directly? See How To Protect SSH with fail2ban on Ubuntu 12.04 | DigitalOcean.
by Etel Sverdlov
fail2ban provides a way to automatically protect virtual servers from malicious behavior. This tutorial shows you how to install Fail2Ban, copy the Configuration File, configure the fail2ban defaults, and find out how to configure the ssh defaults. This tutorial describes the required steps to set up fail2ban on Ubuntu.
My guess is I will never be able to find all of them since I really don't know my way around Linux. For instance, how do I do this for programs I did not install, system stuff where I never read the instructions?

Plus: the server will serve some users who will doubtless try to send meail to - which I will never find unless I redirect them....

I am in the exact same situation. I installed Exim and it sends mail out just fine but I'd like it to forward incoming messages to Gmail so that I can avoid having to use up space for POP and IMAP. Is this possible?
Have another answer? Share your knowledge.