Hi,
I'm using Daemon in a Java program on Linux using jsvc and find that, when
using the -user option, the init method runs as the specified user rather than
the user that launched jsvc, which according to the documentation and in my
case is root. I have tried implementing this by implementing the Daemon
interface and also the Direct way. If I understand the documentation correctly,
when using the -user option, the init method is supposed to run as the calling
user and then the process is forked and setuid is used to downgrade the process
at which point the start method is called and runs as the non-privileged user
specified by the user option, but this is not the behaviour I'm experiencing.
I've compiled jsvc version 1.0.15 and am using Sun Java 1.7.0_45. When I run
jsvc with the debug option, the output indicates it has changed the user to the
non-privileged user before initialising the JVM. If I remove the -user option
and run jsvc as root the code executed by the start method has elevated
privilidges i.e. those of the root account. Is this expected behaviour, a bug
or something I'm doing wrong?