Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to bind a service that I built to port 25. It is a rudimentary SMTP server in PHP.

The problem that I am having is that if I try to bind to that port ... the code binds to some other place, for instance: 39012.

The server is Amazon Linux 64 bits, I have already removed SendMail and rebooted.

If I try it, for instance, on port 1313, it works.

Is any block on ports? How can I fix it to work on port 25?

share|improve this question
up vote 0 down vote accepted

Ports below 1024 require root privileges.

You can use iptables to redirect traffic from 25 to your 1313 port:

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 1313
share|improve this answer
I already did it, but the fault was another. I needed to bind with IP to allow external world access. – Vicenç Gascó Jan 23 '13 at 15:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.