Gian Saß

Open Port 80 for non-root user in Linux

· Gian Sass

Linux is sometimes confusing. Finding out how to open port 80 on Linux wasn’t hard. But I did not know that non-root users cannot listen on ports under 1000!

First I issued following root command.

# iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

Now what you have to do is LINK a port over 8080 to 80.

Using following command.

# iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

Now setting up your app to use port 8080 can be then accessed on port 80!