After having dig for hours on SF/SO and googled a lot, I still can't figure out how /etc/aliases is used by postfix.
- I use an Amazon Linux EC2 server (kind of Centos6)
- My server hostname is set to
srv.example.com
- I have setup postfix 2.6.6 with a null-client config (only to send mails for my website and send reports to my personal mail)
- I set up
/etc/aliases
with rules includingroot: mymail@gmail.com
- I run
newaliases
to take into account the changes in/etc/aliases
- I restarted postfix
sudo service postfix restart
echo "something" | mailx -s D"subject" root
sends a mail toroot@example.com
instead ofmymail@gmail.com
I traced this in /var/log/maillog
:
Mar 13 17:21:23 srv postfix/smtpd[14462]: A27B540A87: client=localhost[127.0.0.1]
Mar 13 17:21:23 srv postfix/cleanup[14466]: A27B540A87: message-id=<55031c93.Il7wUJmrkLu/WLNL%srv@example.com>
Mar 13 17:21:23 srv opendkim[2065]: A27B540A87: DKIM-Signature field added (s=prod-key-swf, d=example.com)
Mar 13 17:21:23 srv postfix/qmgr[14458]: A27B540A87: from=<srv@example.com>, size=820, nrcpt=1 (queue active)
Mar 13 17:21:23 srv sendmail[14461]: t2DHLNlC014461: to=root, ctladdr=srv@example.com (serveur srv) (500/500), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30309, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as A27B540A87)
Mar 13 17:21:25 srv postfix/smtp[14467]: A27B540A87: to=<root@srv.example.com>, relay=aspmx.l.google.com[64.233.186.27]:25, delay=2, delays=0.1/0.01/1.4/0.48, dsn=5.1.1, status=bounced (host aspmx.l.google.com[64.233.186.27] said: 550-5.1.1 The email account that you tried to reach does not exist. Please try 550-5.1.1 double-checking the recipient's email address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1 http://support.google.com/mail/bin/answer.py?answer=6596 f78si2479139qkh.47 - gsmtp (in reply to RCPT TO command))
Mar 13 17:21:26 srv postfix/bounce[14468]: A27B540A87: sender non-delivery notification: 2297E40A86
Mar 13 17:21:26 srv postfix/qmgr[14458]: A27B540A87: removed
My only postfix configuration modifications are (null-client config):
myhostname = srv.example.com
myorigin = $mydomain
relayhost = $mydomain
inet_interfaces = loopback-only
mydestination =
Which step am I missing in order to have /etc/aliases statements applied as expected ?
My sudo postconf -n
:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = loopback-only
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
milter_default_action = accept
mydestination =
myhostname = srv.example.com
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
non_smtpd_milters = $smtpd_milters
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
relayhost = $mydomain
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_milters = inet:127.0.0.1:8891
unknown_local_recipient_reject_code = 550