Changing postfix's incoming smtp port

Which line to change to have Postfix listen on specific ports are well?

This is one of the most simple tasks, yet I had to Google around for hours: change the incoming port of postfix’s SMTP, without iptables prerouting.

Open /etc/postfix/, and search for the following line (usually the first uncommented line):

smtp    inet    n   -   -   -   -   smtpd

To change the port, simply write the number instead of smtp in the begining.

For example:

2525    inet    n   -   -   -   -   smtpd

Restart postfix

/etc/init.d/postfix restart

and the system can not accept messages on the port you added. Don’t forget to enable the port on your firewall, if you have one!

Encourage creation!

If this entry helped you, or you simply liked it, leave a tip via
Monzo (only in the UK or via Google Pay) or Paypal