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

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 .

 apt-get install xinetd

2. Go to /etc/xinetd.d/ and create a new file say redirect_file and put these contents in this file

service my_redirector_80
 disable = no
 socket_type = stream
 protocol = tcp
 user = root
 wait = no
 port = 80
 redirect = localhost 8080
 type = UNLISTED

3. Restart the xinetd service as :

service xinetd restart

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.

About Neelkanth Sachdeva

Project Manager @ eCIFM Solutions Inc. Previous : Senior Software Engineer @ Evernym Inc. Previous : Software Consultant @ Knoldus Software LLP Software Consultant @ Inphina Technologies
This entry was posted in LiftWeb and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s