Redhat – How to make a privileged port non-privileged in Redhat 5

portredhat

So I have a RedHat 5 box that I'm wanting to run an application that I wrote that implements SLP. SLP uses port 427 for answering service queries. My understanding is that ports below 1024 are "privileged" and thus cannot be bound to by anyone that's not root. I cannot run this application as root as it is launched via tomcat.

One creative solution I really like was simply writing an iptables rule to route the privileged port to a non-privileged. In my proof of concept tests, this works wonderfully. Unfortunately, it would be greatly (and understandably) desired by the powers if my application did not require screwing around with iptables upon installation.

So I heard a rumor and cannot find anything to verify this that there was some sort of command or parameter that could be set to make any port I want be non-privileged. Is this true? If so, how is this done? Thanks!

UPDATE

So I saw this post on Stack Overflow: https://stackoverflow.com/questions/413807/is-there-a-way-for-non-root-processes-to-bind-to-privileged-ports-1024-on-l It looks like he used something called capabilities. The problem with this is it seems to require kernel 2.6.24+, but I only have access to kernel 2.6.18. Is there a way to set capabilities on a 2.6.18 box?

Best Answer

You're essentially asking the same thing as this:

https://stackoverflow.com/questions/5544713/starting-tomcat-on-port-80-on-centos-release-5-5-final

So, use jsvc.