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

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.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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 :)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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!
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
stanleyhuenAuthor Commented:
thx chutz,
it seems your comment is very near the answer.
can i listen to both 25 and 1025?

Thank you.

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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.