My previous post is a guide for setting up exim4, an SMTP mail server, to use Gmail as a smarthost. One reason for setting up a mail server is to redirect my local root emails to an Internet email account that I actually monitor. In this way, I won't miss any security alert sent to the localroot mailbox.

This post shows you how to set up email redirection. The instructions are similar for various mail servers: exim4Postfix, or sendmail.

  1. Set up an SMTP server.
  2. Edit /etc/aliases as root.
    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: peter

    To the left of the colon is the mail alias defined on the local machine. You can send email to a local email alias, say security and the message will be redirected to the account(s) specified to the right of the colon.

    In many default mail server configurations, emails to any alias are forwarded to root. But often root itself is not redirected to a regularly monitored email account.

  3. Redirect root.

    Replace the root: peter line with the line below using your personal email address:

    root: yourAddress@gmail.com
    
  4. Rebuild alias database.
    $ newaliases
    

    For sendmail, and Postfix, after you modify the alias file, you need to run the newaliasescommand to rebuild the mail alias database. For exim4, this step is not required because it relies solely on the alias file and NO database.

To test, send root an email, and verify that the message is delivered to the target remote email account.

$ echo 'Code red'| mail -s 'Hacker Alert' root

Redirect local emails to a remote email account的更多相关文章

  1. Step by step Install a Local Report Server and Remote Report Server Database

    原创地址:http://www.cnblogs.com/jfzhu/p/4012097.html 转载请注明出处 前面的文章<Step by step SQL Server 2012的安装 &g ...

  2. Golang : Forwarding a local port to a remote server example

    原文:https://socketloop.com/tutorials/golang-forwarding-a-local-port-to-a-remote-server-example 端口转发, ...

  3. What is the difference between XSS and CSRF from their execution perspective?

    What is the difference between XSS and CSRF from their execution perspective? https://www.quora.com/ ...

  4. SSH的端口转发:本地转发Local Forward和远程转发Remote Forward

    关于使用ssh portforwarding来进行FQ的操作,网络上已经有很多很好的文章,我在这里只是画两个图解释一下. 首先要记住一件事情就是: SSH 端口转发自然需要 SSH 连接,而 SSH ...

  5. 菜鸟学EJB(二)——在同一个SessionBean中使用@Remote和@Local

    不废话.直接进入正题: 在Jboss4及曾经的版本号中,例如以下代码能够成功部署: package com.tjb.ejb; import javax.ejb.Local; import javax. ...

  6. EJB Remote/Local 绑定和JNDI Lookup

    从同事那里学到一种方便的注解SessionBean的方式.代码我放到github去了 https://github.com/EdisonXu/Test/commit/703d49123dca9e666 ...

  7. SSRS2:Reporting Service 配置Service Account

    1,Service Account SSRS以一个Service方式实现,有三部分组成:Web Service,Report Manager和一个后台的进程,这个Service运行的账号就是Servi ...

  8. How to get started with GIT and work with GIT Remote Repo

    https://www.ntu.edu.sg/home/ehchua/programming/howto/Git_HowTo.html#zz-7. 1.  Introduction GIT is a ...

  9. How to Verify Email Address

    http://www.ruanyifeng.com/blog/2017/06/smtp-protocol.html  如何验证 Email 地址:SMTP 协议入门教程 https://en.wiki ...

随机推荐

  1. .Net Core 使用NLog记录日志到文件和数据库

    NLog 记录日志是微软官方推荐使用. 接下来,通过配置日志记录到文件和Sql Server数据库. 第一步:首先添加包NLog.Config (可通过微软添加包命令Install-Package 包 ...

  2. v-bind、v-on 的缩写

    Vue中的缩写:v-bind.v-on v-bind 缩写:: 预期:any (with argument) | Object (without argument) 参数:attrOrProp (op ...

  3. markdown页面内跳转

    分两步 第一步 实际语法比较简单,在需要跳转的位置添加锚点,语法如下: <span id="jump">跳转到的地方</span> 第二步 在需要点击跳转的 ...

  4. h5 html5 模拟时钟 页面

    <!DOCTYPE html> <html><head><meta http-equiv="Content-Type" content=& ...

  5. Linux下ls命令使用详解(转)

    说明:我们在linux下使用ll时,其实就是ls -l.ls才是最终的命令程序. ls命令是linux下最常用的命令之一,ls跟dos下的dir命令是一样的都是用来列出目录下的文件,List即列表的意 ...

  6. android studio2.3.3 模拟器 Jni函数调用C++对象,lldb调试this指针和相关变量显示无效的原因

    android studio2.3.3 的版本中 Jni函数调用C++对象,对象调用相关的成员函数, lldb调试,变量跟踪窗口,this指针和相关变量显示无效的原因,但这些参数实际是有效的,只是de ...

  7. 高性能的数据压缩库libzling-20160105

    libzling(https://github.com/richox/libzling,求观看[watch],求星[star],求叉[fork])是一款高性能的数据压缩库,参见原贴:http://ww ...

  8. H5+百度地图定位

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. mix使用本地依赖

    在看elixir程序设计,书中讲到依赖设置,但是都是要联网,自己希望可以下载到本地电脑硬盘,然后项目要使用就用本地的,不要每次都要下载,因为天朝下载真的不稳 官方看到文档 {:deps_name,pa ...

  10. WPF的Label默认的padding不为0

    1.如图: 要求让“Tools” 左对齐,代码中已设置:HorizontalContentAlignment="Left" <Label Foreground="W ...