How to change smtp port number 25 in postfix

How to change smtp port number 25 in postfix

Bydefault the SMTP protocol runs at port no. 25.
You can change the port no. to any port no. other than below 2048.
0 to 2048 are IANA authorized known port no.but we have some other port no. also which are bydefault used by manyapplication for. eg. port no. 8080 for tomcat.
To know more about port number click this wikipedia URL .

Here we are using Postfix as our MTA.
To change the smtp port no. in postfix,edit the file and change the given below value

vi /etc/postfix/
smtp inet n – n – – smtpd

change smtp word to your desired port no. Here I am changing it to 9267

9267 inet n – n – – smtpd

Now restart the postfix

/etc/init.d/postfix restart

Check the port no. status with netstat command

[root@localhost postfix]# netstat -tanp|grep 9267
tcp 0 0* LISTEN 9788/master
[root@localhost postfix]#

7 thoughts on “How to change smtp port number 25 in postfix”

  1. Thanks you
    That part is OK thanks you again. But then I have other problem

    Dec 12 14:36:43 localhost postfix/smtp[3596]: connect to[]:25: Connection timed out

    25: Connection timed out
    How I can to do. What do you believe?
    UDP and SMTP (port 25) may also be blocked. Maybe operating system is configured with firewalls which block traffic. Is possible to open port within my VPS’s firewall.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.