Snippet 博客主题

[筆記] Dovecot 拒絕特定使用者連線IMAP/POP3 / Reject specified user to connect IMAP/POP3 in dovecot


If users having static IP Addresses on their machines, Yes it is possible with iptables. Just apply following command can restrict the user to access POP3 and IMAP:# iptables -t filter -I INPUT -s <user’s IP Address> -p tcp –dport 110 -d <mail server IP> -j REJECT (or DROP)
# iptables -t filter -I INPUT -s <user’s IP Address> -p tcp –dport 143 -d <mail server IP> -j REJECT (or DROP)

Dont use Mail server IP in case of mail server hosted on this machine.

You can also deny the users in pop3 and imap server like if you have dovecot just remove the comment from following lines in dovecot.conf file. Create files and restart dovecot,


passdb passwd-file {
> File contains a list of usernames, one per line
> args = /etc/dovecot.deny
> deny = yes
> }

2.) Create /etc/dovecot.deny file and add username inside to the file.for more help on dovecot go through the following link : http://wiki.dovecot.org/Authentication/RestrictAccess