You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by raga2 <ra...@gmail.com> on 2009/04/03 12:11:19 UTC

Which user executes JSP in Tomcat?

Hello, 

Running tomcat on linux. I've written a simple JSP script to create a
directory and a file. When I run it via tomcat, the code runs fine, no
errors, but the directory nor the file get created where I specified. I have
a feeling it's some sort of permission issue. Any help is welcome, pretty
new to Tomcat. 



Thanks, 
Raga
-- 
View this message in context: http://www.nabble.com/Which-user-executes-JSP-in-Tomcat--tp22865557p22865557.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Which user executes JSP in Tomcat?

Posted by raga2 <ra...@gmail.com>.
Hello, 


Thanks for you reply and advice. Others asked if the JSP is correct, yes it
is, there are no errors displayed. No catch(Exception ex) { /*do nothing*/} 
kind of code either. 

The error logs for Tomcat don't show anything out of the ordinary. 

Is there anyway to tell tomcat to allow IO access to a specific folder? 

Thanks for your help everyone. 

I'm looking through the log files. 

Caldarale, Charles R wrote:
> 
>> From: raga2 [mailto:ragabonds@gmail.com]
>> Subject: Re: Which user executes JSP in Tomcat?
>> 
>> ps -aef tells me it's root running tomcat.
> 
> That's a really bad thing to do.  You should be running Tomcat under a
> userid that does not give it the privilege to scribble anywhere in the
> file system.  If you need to access ports < 1024, start Tomcat with jsvc,
> or use iptables to redirect the low ports to what's configured in Tomcat.
> 
> Back to your original problem: there's no guarantee that a servlet
> container will allow webapp code to have access to any part of the file
> system, other than a spec-defined work area.  Tomcat usually does allow
> such access, unless you're running with a security manager.  If you're
> trying to use relative paths in your directory and file creation, then
> you're likely trying to write within Tomcat's directory structure, which
> is another Really Bad Thing.  Make sure that wherever you're writing is
> outside of Tomcat.
> 
> (And if you're using a 3rd-party, repackaged version of Tomcat, it's
> anybody's guess where all the pieces of Tomcat are, since the repackagers
> seem to delight in scattering bits of Tomcat all over, and then tying
> things back together with a mess of symlinks - bloody ridiculous.)
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Which-user-executes-JSP-in-Tomcat--tp22865557p22893516.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Which user executes JSP in Tomcat?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: raga2 [mailto:ragabonds@gmail.com]
> Subject: Re: Which user executes JSP in Tomcat?
> 
> ps -aef tells me it's root running tomcat.

That's a really bad thing to do.  You should be running Tomcat under a userid that does not give it the privilege to scribble anywhere in the file system.  If you need to access ports < 1024, start Tomcat with jsvc, or use iptables to redirect the low ports to what's configured in Tomcat.

Back to your original problem: there's no guarantee that a servlet container will allow webapp code to have access to any part of the file system, other than a spec-defined work area.  Tomcat usually does allow such access, unless you're running with a security manager.  If you're trying to use relative paths in your directory and file creation, then you're likely trying to write within Tomcat's directory structure, which is another Really Bad Thing.  Make sure that wherever you're writing is outside of Tomcat.

(And if you're using a 3rd-party, repackaged version of Tomcat, it's anybody's guess where all the pieces of Tomcat are, since the repackagers seem to delight in scattering bits of Tomcat all over, and then tying things back together with a mess of symlinks - bloody ridiculous.)

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


RE: Which user executes JSP in Tomcat?

Posted by Ilya Kazakevich <ka...@devexperts.com>.
Which code exactly you use to create directory? 

-----Original Message-----
From: raga2 [mailto:ragabonds@gmail.com] 
Sent: Friday, April 03, 2009 2:44 PM
To: users@tomcat.apache.org
Subject: Re: Which user executes JSP in Tomcat?


Thanks guys for the reply.

ps -aef tells me it's root running tomcat. 

I'm using tomcat 5.5 and Java 1.5.0 Update 16. 

If it's root running, then why doesn't the directories get created anywhere?
Something I'm doing wrong.




Thanks for your replies again. 

Pid-2 wrote:
> 
> raga2 wrote:
>> Hello,
>> 
>> Running tomcat on linux. I've written a simple JSP script to create a 
>> directory and a file. When I run it via tomcat, the code runs fine, 
>> no errors, but the directory nor the file get created where I 
>> specified. I have a feeling it's some sort of permission issue. Any 
>> help is welcome, pretty new to Tomcat.
>> 
>> 
>> 
>> Thanks,
>> Raga
> 
> type "ps -aef | grep java"
> 
> you should see which user tomcat is running under.
> 
> p
> 
> 
> p.s. Usually helpful to inlcude Tomcat version, java version etc in 
> your post.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

--
View this message in context:
http://www.nabble.com/Which-user-executes-JSP-in-Tomcat--tp22865557p22866000
.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


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


Re: Which user executes JSP in Tomcat?

Posted by raga2 <ra...@gmail.com>.
Thanks guys for the reply.

ps -aef tells me it's root running tomcat. 

I'm using tomcat 5.5 and Java 1.5.0 Update 16. 

If it's root running, then why doesn't the directories get created anywhere?
Something I'm doing wrong.




Thanks for your replies again. 

Pid-2 wrote:
> 
> raga2 wrote:
>> Hello, 
>> 
>> Running tomcat on linux. I've written a simple JSP script to create a
>> directory and a file. When I run it via tomcat, the code runs fine, no
>> errors, but the directory nor the file get created where I specified. I
>> have
>> a feeling it's some sort of permission issue. Any help is welcome, pretty
>> new to Tomcat. 
>> 
>> 
>> 
>> Thanks, 
>> Raga
> 
> type "ps -aef | grep java"
> 
> you should see which user tomcat is running under.
> 
> p
> 
> 
> p.s. Usually helpful to inlcude Tomcat version, java version etc in your
> post.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Which-user-executes-JSP-in-Tomcat--tp22865557p22866000.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Which user executes JSP in Tomcat?

Posted by Pid <p...@pidster.com>.
raga2 wrote:
> Hello, 
> 
> Running tomcat on linux. I've written a simple JSP script to create a
> directory and a file. When I run it via tomcat, the code runs fine, no
> errors, but the directory nor the file get created where I specified. I have
> a feeling it's some sort of permission issue. Any help is welcome, pretty
> new to Tomcat. 
> 
> 
> 
> Thanks, 
> Raga

type "ps -aef | grep java"

you should see which user tomcat is running under.

p


p.s. Usually helpful to inlcude Tomcat version, java version etc in your
post.


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


Re: Which user executes JSP in Tomcat?

Posted by André Warnier <aw...@ice-sa.com>.
Jens Kapitza wrote:
> BTW, is the script right? do all sub-dirs exist?
> 
> Is the path absolut?
> any exceptions in the server log? (log/catalina.out)
> 
I'll add this : is Tomcat running under a security manager ?
(have a look at things like /etc/init.d/tomcat5.5 and 
/etc/default/tomcat5.5)

Anyway, as indicated above, there should be something in a log file, and 
that is always a good point to start looking, (if you can find them).
(The last comment because some Linux distributions have funny ideas 
about re-directing these things).

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


Re: Which user executes JSP in Tomcat?

Posted by Jens Kapitza <j....@schwarze-allianz.de>.
BTW, is the script right? do all sub-dirs exist?

Is the path absolut?
any exceptions in the server log? (log/catalina.out)

---
Jens Kapitza

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


RE: Which user executes JSP in Tomcat?

Posted by Ilya Kazakevich <ka...@devexperts.com>.
Which user tomcat runs at?

BTW, you do not need JSP to create directory and file. JSP is for template
tasks only. Use simple servlet instead.  

-----Original Message-----
From: raga2 [mailto:ragabonds@gmail.com] 
Sent: Friday, April 03, 2009 2:11 PM
To: users@tomcat.apache.org
Subject: Which user executes JSP in Tomcat?


Hello, 

Running tomcat on linux. I've written a simple JSP script to create a
directory and a file. When I run it via tomcat, the code runs fine, no
errors, but the directory nor the file get created where I specified. I have
a feeling it's some sort of permission issue. Any help is welcome, pretty
new to Tomcat. 



Thanks,
Raga
--
View this message in context:
http://www.nabble.com/Which-user-executes-JSP-in-Tomcat--tp22865557p22865557
.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


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


Re: Which user executes JSP in Tomcat?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Raga,

On 4/3/2009 6:11 AM, raga2 wrote:
> Running tomcat on linux. I've written a simple JSP script to create a
> directory and a file. When I run it via tomcat, the code runs fine, no
> errors, but the directory nor the file get created where I specified.

So, no errors but it doesn't actually do what you expected?

Most IO routines throw IOException if they are unable to do whatever it
is you've asked them to do.

Maybe add some logging to your application?

Or, do you have code like this:

try
{
.. do some IO stuff
}
catch (Throwable t)
{ /* do nothing */ }

That'll do it.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAknWg3QACgkQ9CaO5/Lv0PBzywCglSS4R9G4eBlbBslvkpuKdXrK
UwcAn0qPJ+oqD3f3Z/4tL7LTShADS/Pu
=7sDf
-----END PGP SIGNATURE-----

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


Re: Which user executes JSP in Tomcat?

Posted by Jimmy Phillips <ji...@yahoo.com>.
It'll be the user that starts tomcat in the first place.

Jim




________________________________
From: raga2 <ra...@gmail.com>
To: users@tomcat.apache.org
Sent: Friday, April 3, 2009 11:11:19 AM
Subject: Which user executes JSP in Tomcat?


Hello, 

Running tomcat on linux. I've written a simple JSP script to create a
directory and a file. When I run it via tomcat, the code runs fine, no
errors, but the directory nor the file get created where I specified. I have
a feeling it's some sort of permission issue. Any help is welcome, pretty
new to Tomcat. 



Thanks, 
Raga
-- 
View this message in context: http://www.nabble.com/Which-user-executes-JSP-in-Tomcat--tp22865557p22865557.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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