Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
02-18-2005, 07:16 PM
|
#1
|
|
LQ Newbie
Registered: Aug 2003
Location: Maryland
Distribution: Debian, Ubuntu, Solaris
Posts: 23
Rep:
|
Need Java program to listen on ports < 1024 w/o being root - possible
I am in AP Computer Science 3 on the highschool level and am working on my final project which is a client server chat/poker program written in java. We are not allowed to set up webservers on the school compters, so I trying to use my home linux web server hosting the client applet and also running the poker server program. The poker server listens on port 9999 but it seems that my school blocks outgoing connections to 9999. I know that they do not block ports 80, 21, 22, and 23 (and I assume most ports less than 1024) because I have established connections to my server via telnet.
The problem is: if I am a regular user and I try to run the server on ports less than 1024 I get a java security exception when it tries to bind to the port.
Is there a way to run my server on ports less than 1024 without being root?
Don't apache and other servers do this somehow?
Thanks,
Brenan
PS I have tried setting the SUID bit for a script to run the server but that did not work, and if it did I think the server would still be running as root.
|
|
|
|
02-18-2005, 09:51 PM
|
#2
|
|
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 3,824
Rep: 
|
Binding to priviliged ports (as ports < 1024 are called) is an operation only permitted to the root user. What Apache (and like applications) do is actually start out as the root user, and then drop privileges to a normal user (the apache or nobody account, in most cases). I'm not a Java expert ... so I'm not sure if there's a way around this. Doing a google on Java setuid returned a few hits, so those might be where you want to look. Alternatively, you could do SSH port forwarding to try to get around this, or, if you trust your JVM, let the code run as root (to be avoided).
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:33 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|