Results 1 to 2 of 2
- 12-17-2010, 04:21 PM #1Member
- Join Date
- Dec 2010
- Rep Power
Can't listen on ports < 1024 in linux
This is not quite a noobie question, so I would really appreciate your opinion on this topic.
Is there any way to implement something like Apache web server does:
- one process running as root, listening on port 80 (proc_root)
- other processes running as non-root (proc_user)
in that way proc_root can accept() incoming tcp/ip connections and pass some information (handle, object, anything) to proc_user, which will continue handling that connection?
The problem is that I don't want my user process to run as root, just to be able to listen on port < 1024 (in linux). Also, I'm more interested in methods of passing sockets between java processes, if that is possible at all in Java.
Is there any trick to do this in Java?
Thanks in advance.
- 12-17-2010, 08:11 PM #2
yes, this is possible, this is how apache and tomcat usually connect with mod_jk. where i have apache started a root user to bind to port 80. then my tomcat instance runs as a non-root user on the standard ajp13 port, so requests thru apache are sent thru the mod_jk connector to tomcat. it should likely be possible to do this pattern with two java processes too. the trick is the operating system level where we 'run this process as a given user'. I don't know of a way to have a process ran as another user inside java, you would need a shell script wrapper to start it up, or at least have the java program invoke a "su - $user" kind of launch child process thing.
- By gisler in forum NetworkingReplies: 1Last Post: 12-17-2009, 03:57 AM
- By matzahboy in forum AWT / SwingReplies: 5Last Post: 10-13-2009, 04:15 PM
- By sh4dyPT in forum AWT / SwingReplies: 5Last Post: 07-16-2009, 01:45 PM
- By Eranga in forum Advanced JavaReplies: 6Last Post: 04-08-2009, 04:05 AM
- By pjr5043 in forum New To JavaReplies: 17Last Post: 09-29-2008, 03:37 AM