how to setup qmail with smtp using port 1025 or other port other than 25?

Posted on 2004-11-06
Last Modified: 2012-06-27
Dear All,

I have a qmail server now, it is running smtp with default port, 25.
Now, I want to change it to another port other than 25, eg, 1025, or 3388,
how can I do that?

Which files I have to modify?

Thank you.

Question by:stanleyhuen
    LVL 2

    Accepted Solution

    Look into /var/qmail/control/conf-common file (at leat on my distribution) and look for the following lines:

    # Host and port to listen on
    # We listen on the IPv4 local ip by default

    Change TCPSERVER_PORT=1025 for example and restart service :)
    LVL 2

    Assisted Solution

    I can't remember the files myself and don't have access to my home system at the moment.  However, you may want to check the website:

    The entire site is dedicated to installation and configuration of Qmail.  It's been very handy for my own issues.  Good luck!
    LVL 1

    Assisted Solution

    deurk: You are talking about a gentoo specific configuration file. Gentoo's configuration sucks, so better do it the way djb advizes.

    Stanley: If you followed djb's instructions, your smtp server is probably being run from /service. So just "cd /service/qmail-smtpd". Then edit the "run" file in that directory. It should have a reference to "tcpserver". Find the two parameters that give the ip address and port to listen on (these should be obvious, because one of them should be 25) and change the port from 25 to 1025. If you are running gentoo, then follow deurk's advice.

    Restarting the service in the end: svc -t /service/qmail-smtpd

    Author Comment

    thx chutz,
    it seems your comment is very near the answer.
    can i listen to both 25 and 1025?

    Thank you.

    LVL 1

    Assisted Solution

    All you need are two instances of tcpserver and you're done. You could simply copy the directory where the current configuration is to another one, edit the run file and link the new directory in /service. Ah, also be careful to edit the logger path, in case your are logging to an absolute location. Something along the lines of:

    cd /service
    dir=$(dirname $(readlink qmail-smtpd))
    cp -av $dir/qmail-smtpd $dir/qmail-smtpd-1025
    $EDITOR $dir/qmail-smtpd-1025/run
    $EDITOR $dir/qmail-smtpd-1025/log/run
    rm -f $dir/qmail-smtpd-1025/log/main/*
    ln -s $dir/qmail-smtpd-1025

    Or just create the new directory yourself, copy over the "run" file and edit it. Do the same for the "log" directory.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
    Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now