Quantcast
Channel: Admins Goodies » port
Viewing all articles
Browse latest Browse all 10

Bind socket to port 25 in EC2

$
0
0

Question

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?

Answer

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
Answered by ceejayoz

Viewing all articles
Browse latest Browse all 10

Trending Articles