How can i run the native process as different user
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ajay_Sinha
Posted On:   Friday, November 4, 2005 01:17 AM

My java application is starts as "root" user on a solaris box.

This java program launches apache by making use of  RunTime.exec()
method. 

By doing this apache also starts as "root" user, but I want to start
this as "nobody" user.


How can i start the apache from a different OS user account?

Re: How can i run the native process as different user

Posted By:   Jani_Kaarela  
Posted On:   Friday, November 4, 2005 02:41 AM


Unless Apache uses a port above 1024, it needs root privileges to start. It spawns non-privileged child processes to serve requests. See Starting Apache (for Apache 1.3, see this page).



Anyway, I don't think there's a method of managing user privileges in Java. I'd write a wrapper script which uses sudo to run the actual script/executable with the desired privileges.

About | Sitemap | Contact