You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by sa...@twinix.com on 2008/09/06 00:24:23 UTC

Re: jsvc creates pid file owned by root

See Thread at: http://www.techienuggets.com/Detail?tx=31984 Posted on
behalf of a User

>>You shouldn't be messing about with the ownership of the PID file. It is
>>created by jsvc at startup. If you use jsvc properly it will start as
>>root, create the pid file, startup tomcat ...

Ah, but what if you are using jsvc to run something other than tomcat?

I am using jsvc to run a standalone java application as a daemon that
starts whenever the server is restarted.  However, I would like a certain
user other than root to be able to run the same launching script for this
daemon to start and stop the service as needed.

I find I cannot do it because of the permission on the .pid file.  No
matter where I put the pidfile and no matter whether or not I run umask in
the launching script, the pidfile gets created with an owner of root and
perms of 600.   

If I run umask 133 and then create a file, I get perm 644 as I want on the
file.  But the same does not work from within my jsvc-launch script with
the pid file.

Nothing I've tried works.

In Response To: 


Hi,

I can start and stop Tomcat 5.5 with the jsvc program but the problem is
that the pid file is created with permissions 600 and owned by root.
I want to be able to read the pid file to check if the Tomcat process is up
and running 
and also for other purposes.

Is it possible to make the pid file be owned by the user that runs Tomcat or
have the permissions to be set to 666?

Regards
Gunnar

-- 
<...>
http://www.nabble.com/jsvc-creates-pid-file-owned-by-root-tp16606528p1660652
8.html
Sent from the Tomcat - User mailing list archive at <...>.


---------------------------------------------------------------------
To start a new topic, e-mail: noway@spam.com
To unsubscribe, e-mail: users-noway@spam.com
For additional commands, e-mail: users-noway@spam.com




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: jsvc creates pid file owned by root

Posted by Martin Gainty <mg...@hotmail.com>.
if you're in Ubuntu and want to exec a process with elevated privileges 
try Coggshall's (sp?) sudo utility
http://en.wikipedia.org/wiki/Sudo

Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 


> Date: Fri, 5 Sep 2008 17:34:56 -0500
> From: scohen@javactivity.org
> To: users@tomcat.apache.org
> Subject: Re: jsvc creates pid file owned by root
> 
> samk@twinix.com wrote:
> > See Thread at: http://www.techienuggets.com/Detail?tx=31984 Posted on
> > behalf of a User
> >
> >   
> >>> You shouldn't be messing about with the ownership of the PID file. It is
> >>> created by jsvc at startup. If you use jsvc properly it will start as
> >>> root, create the pid file, startup tomcat ...
> >>>       
> >
> > Ah, but what if you are using jsvc to run something other than tomcat?
> >
> > I am using jsvc to run a standalone java application as a daemon that
> > starts whenever the server is restarted.  However, I would like a certain
> > user other than root to be able to run the same launching script for this
> > daemon to start and stop the service as needed.
> >
> > I find I cannot do it because of the permission on the .pid file.  No
> > matter where I put the pidfile and no matter whether or not I run umask in
> > the launching script, the pidfile gets created with an owner of root and
> > perms of 600.   
> >
> > If I run umask 133 and then create a file, I get perm 644 as I want on the
> > file.  But the same does not work from within my jsvc-launch script with
> > the pid file.
> >
> > Nothing I've tried works.
> >
> > In Response To: 
> >
> >
> > Hi,
> >
> > I can start and stop Tomcat 5.5 with the jsvc program but the problem is
> > that the pid file is created with permissions 600 and owned by root.
> > I want to be able to read the pid file to check if the Tomcat process is up
> > and running 
> > and also for other purposes.
> >
> > Is it possible to make the pid file be owned by the user that runs Tomcat or
> > have the permissions to be set to 666?
> >
> > Regards
> > Gunnar
> >
> >   
> I am the anonymous author of the piece you're responding to. What a 
> coincidence seeing it bounce back here on the Tomcat list - Of course, 
> my example did NOT concern Tomcat.
> 
> Anyway my JSVC daemon needs to fulfill two needs:
> 1) restart the application on bootup - which is done by root
> 2) allow non-root user to start-stop the application using the standard 
> daemon start/stop/restart kinds of commands.
> 
> The only way I could get this to work was to modify my shell script to 
> change the permissions and the group of the pid file after the jsvc 
> start call was made. This works very nicely. Putting a call to umask in 
> the script before the jsvc invocation did not work. I still don't know why.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
Stay up to date on your PC, the Web, and your mobile phone with Windows Live.
http://clk.atdmt.com/MRT/go/msnnkwxp1020093185mrt/direct/01/

Re: jsvc creates pid file owned by root

Posted by Steve Cohen <sc...@javactivity.org>.
samk@twinix.com wrote:
> See Thread at: http://www.techienuggets.com/Detail?tx=31984 Posted on
> behalf of a User
>
>   
>>> You shouldn't be messing about with the ownership of the PID file. It is
>>> created by jsvc at startup. If you use jsvc properly it will start as
>>> root, create the pid file, startup tomcat ...
>>>       
>
> Ah, but what if you are using jsvc to run something other than tomcat?
>
> I am using jsvc to run a standalone java application as a daemon that
> starts whenever the server is restarted.  However, I would like a certain
> user other than root to be able to run the same launching script for this
> daemon to start and stop the service as needed.
>
> I find I cannot do it because of the permission on the .pid file.  No
> matter where I put the pidfile and no matter whether or not I run umask in
> the launching script, the pidfile gets created with an owner of root and
> perms of 600.   
>
> If I run umask 133 and then create a file, I get perm 644 as I want on the
> file.  But the same does not work from within my jsvc-launch script with
> the pid file.
>
> Nothing I've tried works.
>
> In Response To: 
>
>
> Hi,
>
> I can start and stop Tomcat 5.5 with the jsvc program but the problem is
> that the pid file is created with permissions 600 and owned by root.
> I want to be able to read the pid file to check if the Tomcat process is up
> and running 
> and also for other purposes.
>
> Is it possible to make the pid file be owned by the user that runs Tomcat or
> have the permissions to be set to 666?
>
> Regards
> Gunnar
>
>   
I am the anonymous author of the piece you're responding to. What a 
coincidence seeing it bounce back here on the Tomcat list - Of course, 
my example did NOT concern Tomcat.

Anyway my JSVC daemon needs to fulfill two needs:
1) restart the application on bootup - which is done by root
2) allow non-root user to start-stop the application using the standard 
daemon start/stop/restart kinds of commands.

The only way I could get this to work was to modify my shell script to 
change the permissions and the group of the pid file after the jsvc 
start call was made. This works very nicely. Putting a call to umask in 
the script before the jsvc invocation did not work. I still don't know why.




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org