How can I configure qmail to run on another port on my Plesk Linux server?

The smtp daemon for Qmail/Plesk is ran from Xinetd.

In /etc/xinetd.d/ you will see this:


[root@root xinetd.d]# ls -l smpt*
-rw-r—r—    1 root     root          400 Jul 18 23:18 smtp_psa
-rw-r—r—    1 root     root          401 Jul 18 23:18 smtps_psa
[root@root xinetd.d]#


The contents of the files:



[root@root xinetd.d]# cat smtp_psa

service smtp
{
        socket_type     = stream
        protocol        = tcp
        wait            = no
        disable         = no
        user            = root
        instances       = UNLIMITED
        server          = /var/qmail/bin/tcp-env
        server_args     = /usr/sbin/rblsmtpd  -r bl.spamcop.net /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
}

Copy one of these files to another file called something like “smtp2_psa”, change the “service” name in the file, then add the service “smtp2” to /etc/services, corresponding to the NEW port number, such as 26.



[root@root xinetd.d]# cp smtp_psa  smtp2_psa


Change the service line in the new file ‘smtp2_psa” to be this:



service smtp2
{
        socket_type     = stream
        protocol        = tcp
        wait            = no
        disable         = no
        user            = root
        instances       = UNLIMITED
        server          = /var/qmail/bin/tcp-env
        server_args     = /usr/sbin/rblsmtpd  -r bl.spamcop.net /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
}


Edit /etc/services with your favorite editor and add the tcp and udp lines for this service the lines should look like this:


smtp2           26/tcp          mail
smtp2           26/udp          mail


After this restart xinetd:



[root@root xinetd.d]# /etc/init.d/xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                            [  OK  ]


And you should see smtp listening on ports 25, and 26:



[root@root xinetd.d]# netstat -anp | grep xinetd
****cut****
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      6989/xinetd
tcp        0      0 0.0.0.0:26              0.0.0.0:*               LISTEN      6989/xinetd
****cut****
[root@root xinetd.d]#


Make the appropriate changes if you want to run this second service on a port other than 26.

Your rating: None Average: 4 (2 votes)