Penguin
Note: You are viewing an old revision of this page. View the current version.

If you want to be able to run a process that responds to requests on a Port below 1024 without running it as the SuperUser, a simple approach is to have it bind to some port above 1024, then configure a lower layer in the NetworkStack to do the legwork. On Linux, a convenient way to achieve this is by using iptables(8):

iptables --table nat -A PREROUTING -p tcp --dport $external_port -i eth0 -j REDIRECT --to-ports $local_port

This way, you could have a process bind to port 8080 locally, but have it appear to outsiders as though it was listening on port 80.

(Don’t forget to issue something like /etc/init.d/iptables save so this configuration won’t be lost on reboot.)


UserSubmittedNotes