# Change Postfix Port

> How to run postfix with a different port - Linux

- Canonical URL: <https://carlossura.com/blog/change-postfix-port/>
- Author: Carlos Sura
- Published: 2019-10-03
- Tags: linux, centos, postfix, port, update, smtp, mta

I was trying to route emails from one MTA to postfix, so I needed to change the port that postfix was using, so this is what I did:

First, please backup the file in case you break something

```
cp /etc/postfix/master.cf /etc/postfix/master.cf.bak
```

Let's edit the following file:

```
vim /etc/postfix/master.cf
```

Make it look like this:

```
==========================================================================
# service type  private unpriv  chroot wakeup  maxproc command + args
#               (yes)   (yes)   (yes)  (never) (100)
# ==========================================================================
#smtp      inet  n       -       n      -       -       smtpd
2525      inet  n       -       n      -       -       smtpd  ## This is the new port
```

Restart postfix and verify by running the following commands:

```
systemctl restart postfix
netstat -plutn | grep 2525
```

There you go!

P.S. Millennials are allowed to use [**nano**](https://www.nano-editor.org/)
