Quick Tip : How to make Jetty webserver listen on port 80 as a non-root user

Knoldus Inc.
Knoldus - Technical Insights
1 min readMay 29, 2013

We had a requirement to run an application on a different port which was running at port 8080 (Jetty) by default . One of our Lift application was running at port 8080 on Linux (Ubuntu 13.04 ) machine & we wanted to run it at port 80. Usually on Linux machines, port 80 is protected. Typically only the superuser root can open it and ports below 1024 can be opened only by root. Here is how we did it as a normal user ( Non-root user) :

1. Install Xinetd .
[code language=”html”]
apt-get install xinetd
[/code]

2. Go to /etc/xinetd.d/ and create a new file say redirect_file and put these contents in this file
[code language=”html”]
service my_redirector_80
{
disable = no
socket_type = stream
protocol = tcp
user = root
wait = no
port = 80
redirect = localhost 8080
type = UNLISTED
}
[/code]

3. Restart the xinetd service as :
[code language=”html”]
service xinetd restart
[/code]

4. This is all you’ve to do. Now you should be able to find the application running ( which is running at port 8080 ) on port 80.

--

--

Knoldus Inc.
Knoldus - Technical Insights

Group of smart Engineers with a Product mindset who partner with your business to drive competitive advantage | www.knoldus.com