want to start tomcat from php

This is a discussion on want to start tomcat from php within the PHP Language forums, part of the PHP Programming Forums category; hi everyone..sorry everyone if ive posted on the wrong group but i really needed help.... i wan tto start ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2006
danish
 
Posts: n/a
Default want to start tomcat from php

hi everyone..sorry everyone if ive posted on the wrong group but i
really needed help....

i wan tto start jakarta-tomcat-5.5.3 from the webbrowser using the
sheel scripts...i normally use the shell scripts from the command line
to start and stop the tomcat server.....

i found out that php gives this incredible facility where i can execute
normal bash commands...i tried doing so ..but a simple command like {
system('whoami') } from
browser......eg.....http://localhost/startup.php..

prints apache as the user....so technically it executes the tomcat
startup script as apache user..but ive got
jakarta-tomcat-5.5.3 under the tomcat user....can someone please tell
me is there a way in php coding wherein i can execute the command as
another....i know this seems a bit out of place...but i really didnt
know anywhere else to go

danish

Reply With Quote
  #2 (permalink)  
Old 03-01-2006
Jerry Stuckle
 
Posts: n/a
Default Re: want to start tomcat from php

danish wrote:
> hi everyone..sorry everyone if ive posted on the wrong group but i
> really needed help....
>
> i wan tto start jakarta-tomcat-5.5.3 from the webbrowser using the
> sheel scripts...i normally use the shell scripts from the command line
> to start and stop the tomcat server.....
>
> i found out that php gives this incredible facility where i can execute
> normal bash commands...i tried doing so ..but a simple command like {
> system('whoami') } from
> browser......eg.....http://localhost/startup.php..
>
> prints apache as the user....so technically it executes the tomcat
> startup script as apache user..but ive got
> jakarta-tomcat-5.5.3 under the tomcat user....can someone please tell
> me is there a way in php coding wherein i can execute the command as
> another....i know this seems a bit out of place...but i really didnt
> know anywhere else to go
>
> danish
>


Not if the OS won't let you.

You potentially could do a posix_setuid to change the uid, but that has
to be allowed by the OS and most won't because of the potential (huge)
security risk.

You may be able to su to the tomcat user - but again the OS must be set
up to allow it.

You can't do anything the OS won't allow. What you really need is a
Unix Admin to set up the permissions you need.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote
  #3 (permalink)  
Old 03-05-2006
danish
 
Posts: n/a
Default Re: want to start tomcat from php

Jerry Stuckle wrote:
> danish wrote:
> > hi everyone..sorry everyone if ive posted on the wrong group but i
> > really needed help....
> >
> > i wan tto start jakarta-tomcat-5.5.3 from the webbrowser using the
> > sheel scripts...i normally use the shell scripts from the command line
> > to start and stop the tomcat server.....
> >
> > i found out that php gives this incredible facility where i can execute
> > normal bash commands...i tried doing so ..but a simple command like {
> > system('whoami') } from
> > browser......eg.....http://localhost/startup.php..
> >
> > prints apache as the user....so technically it executes the tomcat
> > startup script as apache user..but ive got
> > jakarta-tomcat-5.5.3 under the tomcat user....can someone please tell
> > me is there a way in php coding wherein i can execute the command as
> > another....i know this seems a bit out of place...but i really didnt
> > know anywhere else to go
> >
> > danish
> >

>
> Not if the OS won't let you.
>
> You potentially could do a posix_setuid to change the uid, but that has
> to be allowed by the OS and most won't because of the potential (huge)
> security risk.
>
> You may be able to su to the tomcat user - but again the OS must be set
> up to allow it.
>
> You can't do anything the OS won't allow. What you really need is a
> Unix Admin to set up the permissions you need.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstucklex@attglobal.net
> ==================


well..im not very familiar with setuid n stuff...but from what ive
tried....i can sudo to the tomcat user or if i want use a normal user
to start tomcat using sudo.....but basically i dont want that....i
heard that tomcat can be integrated with php..if that is possible maybe
i can execute normal commands as the tomcat user..and as the tomcat
user is allowd to start tomcat..maybe i can start tomcat from the
webpage....what du u think



danish

Reply With Quote
  #4 (permalink)  
Old 03-05-2006
Jerry Stuckle
 
Posts: n/a
Default Re: want to start tomcat from php

danish wrote:
> Jerry Stuckle wrote:
>
>>danish wrote:
>>
>>>hi everyone..sorry everyone if ive posted on the wrong group but i
>>>really needed help....
>>>
>>>i wan tto start jakarta-tomcat-5.5.3 from the webbrowser using the
>>>sheel scripts...i normally use the shell scripts from the command line
>>>to start and stop the tomcat server.....
>>>
>>>i found out that php gives this incredible facility where i can execute
>>>normal bash commands...i tried doing so ..but a simple command like {
>>>system('whoami') } from
>>>browser......eg.....http://localhost/startup.php..
>>>
>>>prints apache as the user....so technically it executes the tomcat
>>>startup script as apache user..but ive got
>>>jakarta-tomcat-5.5.3 under the tomcat user....can someone please tell
>>>me is there a way in php coding wherein i can execute the command as
>>>another....i know this seems a bit out of place...but i really didnt
>>>know anywhere else to go
>>>
>>>danish
>>>

>>
>>Not if the OS won't let you.
>>
>>You potentially could do a posix_setuid to change the uid, but that has
>>to be allowed by the OS and most won't because of the potential (huge)
>>security risk.
>>
>>You may be able to su to the tomcat user - but again the OS must be set
>>up to allow it.
>>
>>You can't do anything the OS won't allow. What you really need is a
>>Unix Admin to set up the permissions you need.
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>jstucklex@attglobal.net
>>==================

>
>
> well..im not very familiar with setuid n stuff...but from what ive
> tried....i can sudo to the tomcat user or if i want use a normal user
> to start tomcat using sudo.....but basically i dont want that....i
> heard that tomcat can be integrated with php..if that is possible maybe
> i can execute normal commands as the tomcat user..and as the tomcat
> user is allowd to start tomcat..maybe i can start tomcat from the
> webpage....what du u think
>
>
>
> danish
>


Yes, Tomcat can be integrated with PHP.

But PHP itself is not a daemon like Tomcat or Apache. Rather it runs
under the current user.

So, to execute a PHP script as Tomcat, you need to either run the script
under Tomcat (or another process using the same ID) or su to the Tomcat id.

If you're going to start fooling with uid's, I highly suggest you get a
book on Linux administration and get familiar with them. You can very
easily leave huge security holes in your system if you do the wrong thing.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:17 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0