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 postfix+dovecot, and currently postfix is delivering to local accounts:

local_recipient_maps = proxy:unix:passwd.byname $alias_maps

The spammers have found one of my user's accounts and the deluge is getting problematic. What I'd like to know is how to disable local delivery to this one UID (we'll call it 'joeuser').


share|improve this question
up vote 0 down vote accepted

You can set hash map with check_recipient_access in smtpd_recipient_restrictions to restrict mail delivery to certain users:

   smtpd_recipient_restrictions = 
      check_recipient_access hash:/etc/postfix/access_recipient

/etc/postfix/access_recipient: REJECT
share|improve this answer
Thanks, Alex. When I add the email addy to that file, postmap'ed it and reload postfix, I still get deliveries to it. :/ The line looks like this: smtpd_recipient_restrictions = permit_sasl_authenticated permit_mynetworks reject_unauth_destination check_policy_service unix:private/policy permit check_recipient_access hash:/etc/postfix/access_recipient. However, when I put this as the first condition on the line, it started working. – MikeC Apr 21 '13 at 2:40
@MikeC all checks in smtpd_recipient_restrictions applied in order they are written and first one which returns PERMIT or REJECT wins, all remaining checks are skipped. – AlexD Apr 21 '13 at 6:52

The easiest way to achieve this is to simply forward the mail for this specific user to /dev/null.

Edit /etc/aliases and insert a line that looks like this

joeuser: /dev/null

Save, quit and execute this command: newaliases

After that, postfix will just get rid of e-mail sent to that account rather than delivering it locally - see maillog example:

Apr 20 08:49:50 clustermx04 postfix/qmgr[31542]: 8BE7A720716: from=<mail@removed>, size=881, nrcpt=1 (queue active)

Apr 20 08:49:50 clustermx04 postfix/local[26205]: 8BE7A720716: to=<>, relay=local, delay=0.38, delays=0.38/0/0/0, dsn=2.0.0, status=sent (delivered to file: /dev/null)

Apr 20 08:49:50 clustermx04 postfix/qmgr[31542]: 8BE7A720716: removed
share|improve this answer
Thanks, Frands. This also works well. I do like the idea of sending back a 500 message to the sender that the recip doesn't exist. Thanks for the info. – MikeC Apr 21 '13 at 3:20

In addition to AlexD's answer above, it is necessary to actually create the postfix db file from the text file that is mentioned by running postmap /etc/postfix/access_recipient. Otherwise postfix will complain that it can't find access_recipient.db and will block every mail for any user.

More details can be found here:

(Sorry, I can't comment yet here, hence a full answer).

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.