Postfix mail server limit the mailbox size

So how do you limit the mailbox size for users configured with the Postfix mail server?

It is good choice to avoid problem (disk DoS) by limiting mailbox size. This will avoid the user or hacker to eat up all hard disk space.

Display the default mailbox size limit

Type the following command:
# postconf mailbox_size_limit

mailbox_size_limit = 51200000

51200000 bytes is default mailbox size limit.

Display the default maximum size in bytes of a message

Type the following command:
# postconf message_size_limit

message_size_limit = 10240000

Setup new mailbozsize limit

Open file /etc/postfix/ and
# vi /etc/postfix/
Add/modify/set values as follows:
mailbox_size_limit = 30000000
message_size_limit = 10240000

Save and restart postfix mail server:
# /etc/init.d/postfix restart

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 6 comments so far... add one
CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
6 comments… add one
  • ashraf Oct 29, 2007 @ 13:20

    this option is for all users ,
    how to make diffrent mail box sizes for diffreent users or groups

    • Jorge Pelliza Apr 16, 2012 @ 17:36

      Hi, you have to use LDAP or Mysql so you may create an attribute that defines the mailQuotaSize for each user.
      In my site, I have a complete guide to do this, but is in spanish.

      • A. May 23, 2014 @ 11:21

        Why don’t you post the link? Some of us may actually speak Spanish.

  • david Sep 23, 2012 @ 8:12

    My maths is a little rusty but I think that 3 is a smaller number than 5. In other words in effect you have shrunk the mailbox_size_limit. Perhaps adding a zero to 51200000 or just doubling the figure would do it.

    all the best

  • david Sep 23, 2012 @ 8:46

    Scrap that. I have just realised that the post is to shrink the mailbox size. Its just that yesterday I was looking to grow the mailbox size and got fixated upon that idea.

    all the best

  • tomas shapumba May 22, 2013 @ 19:54

    what commands should i use for checking post fix size

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum