Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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 0.0.0.0 to allow external world access. –  Vicenç Gascó Jan 23 '13 at 15:54

Your Answer

 
discard

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.