Looking at the JSVC documentation, it appears it already supports [1]
this functionality (-user option). I don't believe you need to do
anything special with the application's initialization code.
I'd recommend following up with the jsvc creators to confirm this -
particularly, if it isn't working.
[1] Jsvc allows the application (e.g. Tomcat) to perform some privileged
operations as root (e.g. bind to a port < 1024), and then switch
identity to a non-privileged user.
mccluresc_at_gmail.com wrote:
> Hi all,
>
> I am trying to use JSVC to bind to a privileged port while root, than
> run the application as a separate user. This would require that I bind
> the port separate from starting the server (accepting connections /
> creating a thread pool, etc)
>
> The issue I am facing is in NetworkListener.start() - this call
> combines the TCPNIOTransport.bind and the TCPNIOTransport.start.
>
> Additionally, it appears that TCPNIOTransport.bind also listens on the
> port as well.
>
> Any suggestions on how to separate binding to the port from the rest of
> the operations? Or alternatively, any suggestions on how to bind to
> Grizzly a privileged port? Specifically - has anyone used authbind with
> Grizzly?
>
> Thanks!
> - Scott