Running on linux and using restricted ports


I'm experimenting with switching to Linux and have set up my Ubuntu box with the Linux version.

The application that I'm developing starts a webserver (jetty) on port 80 of the localhost and runs an ssh server on port 22. The same setup works fine on the XP box but with Linux, I'm getting a "Failed to start: SocketListener0@" for the httpserver. If I change the port to be 8000, it works fine (but causes other issues which I rather not address). I'd like to be able to run my app on restricted ports. Any ideas how to accomplish this? I tried using sudo but that runs as root and would mean I'd have to change file perms on all my source.

Thanks for the advice in advance!

Comment actions Permalink

There's not much you can do about that. Only the root user has the permission to listen on ports below 1000, so using sudo is the only possibility to stay on restricted ports.

What I'm doing in such situations is to have my web application listen on port 8080 and access it through an apache server in front of it (which itself is started as root and can listen on port 80).

Comment actions Permalink

This link describes a way to do this without having to run the webserver as root by using iptables:


Please sign in to leave a comment.