You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Li <am...@gmail.com> on 2006/07/26 12:47:24 UTC
Uploading problem
Hi all,
I had a struts webapp remotely running with tomcat (started using startup.sh,
not catalina.sh start -security) in Fedora Core 4 machine. When I was trying
to upload from my local machine. uploading failed.
The dir which stores the uploaded files is out of tomcat home dir, i gave
its access right to read write, also assigned the same user and group id as
tomcat server. So I guess it should not be the FS accessing setup problem,
but much likely at tomcat side.
Any idea?
Thanks
Re: Uploading problem
Posted by Li <am...@gmail.com>.
hi David,
Thanks for replying,
1) the no matter /tmp or /temp, it is ok, just a subdir.
2), you are right, enable catalina security manager may fix my problem, but
it will do the check up during runtime. I was wondering if there is any
solution without using that .... any ideas?
On 7/26/06, David Friedman <hu...@ix.netcom.com> wrote:
>
> 1) Your path of "/var/../../temp/test123.jpg" suggests a UNIX style
> server.
> Using standard UNIX conventions, that would make the actual path used by
> your file be "/temp/test123.jpg". Sadly, on every UNIX/Solaris/Linux/etc.
> server I've ever worked on, the file system was named "/tmp", not "/temp".
> Are you sure this subtle difference is not the problem?
>
> 2) Additionally, you mentioned you are using Tomcat. It has a JAAS
> security
> file, $TOMCAT_HOME/conf/catalina.policy, in which you can change the
> permissions allowed for various files, file types, and directories. It is
> possible you may need to alter that file with the correct GRANT
> permissions
> for "/temp" (or "/tmp" depending on what you are using).
>
> Regards,
> David
>
> -----Original Message-----
> From: Antonio Petrelli [mailto:brenmcguire@tariffenet.it]
> Sent: Wednesday, July 26, 2006 8:22 AM
> To: Struts Users Mailing List
> Subject: Re: Uploading problem
>
>
> Li ha scritto:
> > yes, /temp existed
> >
> > if i just use normal java app to write on that machine, no problem.
>
> Very strange...
>
> >
> > As long as i use tomcat to write to dir out of tomcat home dir, it has
> > problem, i was trying to fix it without using catalina security manager
>
> I don't think it is necessary simply because we have a webapp that
> writes outside of Tomcat dir and that doesn't use it.
> Try asking Tomcat's mailing list, maybe they have a solution. Also try
> to write a simple servlet that writes in the same directory, so Tomcat
> list people cannot say "It's a Struts issue" :-)
>
> Sorry for not being helpful
> Ciao
> Antonio
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
When we invent time, we invent death.
Re: Uploading problem
Posted by Li <am...@gmail.com>.
Hi, Philippe,
I started tomcat as user:tomcat group:tomcat, there is no security problem
of access my data or even all my jsp pages were secured so that direct
access to page source is also not allowed.
I did give 770 (way enough) to let tomcat write that /temp, which /temp has
same user and group ID.
On 7/26/06, Philippe Schober <ph...@scaraboo.com> wrote:
>
> Hi,
>
> Li schrieb:
> > thanks for replying, i guess my linux access config no problem since i
> can
> > use normal java app to write up.
> Because normal java-apps run with the same rights as the user starting
> them.
>
> > I guess it should be the problem for tomcat
> > configure at its security model. And besides, use root run tomcat is not
> > very good.
> Tomcat runs with different rights (I believe the rights of the web
> server). Why that? Well, you don't want your web browser to access your
> private data outside your home page...
>
> And you weren't asked to run tomcat as root but change the security
> settings of the temp dir. The command you were told changes the settings
> so that EVERYONE on your machine may read, write and execute stuff from
> the temp directory.
>
> Cheers,
> Philippe Schober
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
When we invent time, we invent death.
Re: Uploading problem
Posted by Philippe Schober <ph...@scaraboo.com>.
Hi,
Li schrieb:
> thanks for replying, i guess my linux access config no problem since i can
> use normal java app to write up.
Because normal java-apps run with the same rights as the user starting them.
> I guess it should be the problem for tomcat
> configure at its security model. And besides, use root run tomcat is not
> very good.
Tomcat runs with different rights (I believe the rights of the web
server). Why that? Well, you don't want your web browser to access your
private data outside your home page...
And you weren't asked to run tomcat as root but change the security
settings of the temp dir. The command you were told changes the settings
so that EVERYONE on your machine may read, write and execute stuff from
the temp directory.
Cheers,
Philippe Schober
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Uploading problem
Posted by Li <am...@gmail.com>.
hi Irwan,
thanks for replying, i guess my linux access config no problem since i can
use normal java app to write up. I guess it should be the problem for tomcat
configure at its security model. And besides, use root run tomcat is not
very good.
Thanks any way
Hi Antonio,
Yeah, i just added, thanks for your replies. I really appreciated.
Regards
On 7/26/06, Antonio Petrelli <br...@tariffenet.it> wrote:
>
> Li ha scritto:
> > yes, /temp existed
> >
> > if i just use normal java app to write on that machine, no problem.
>
> Very strange...
>
> >
> > As long as i use tomcat to write to dir out of tomcat home dir, it has
> > problem, i was trying to fix it without using catalina security manager
>
> I don't think it is necessary simply because we have a webapp that
> writes outside of Tomcat dir and that doesn't use it.
> Try asking Tomcat's mailing list, maybe they have a solution. Also try
> to write a simple servlet that writes in the same directory, so Tomcat
> list people cannot say "It's a Struts issue" :-)
>
> Sorry for not being helpful
> Ciao
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
When we invent time, we invent death.
RE: Uploading problem
Posted by David Friedman <hu...@ix.netcom.com>.
1) Your path of "/var/../../temp/test123.jpg" suggests a UNIX style server.
Using standard UNIX conventions, that would make the actual path used by
your file be "/temp/test123.jpg". Sadly, on every UNIX/Solaris/Linux/etc.
server I've ever worked on, the file system was named "/tmp", not "/temp".
Are you sure this subtle difference is not the problem?
2) Additionally, you mentioned you are using Tomcat. It has a JAAS security
file, $TOMCAT_HOME/conf/catalina.policy, in which you can change the
permissions allowed for various files, file types, and directories. It is
possible you may need to alter that file with the correct GRANT permissions
for "/temp" (or "/tmp" depending on what you are using).
Regards,
David
-----Original Message-----
From: Antonio Petrelli [mailto:brenmcguire@tariffenet.it]
Sent: Wednesday, July 26, 2006 8:22 AM
To: Struts Users Mailing List
Subject: Re: Uploading problem
Li ha scritto:
> yes, /temp existed
>
> if i just use normal java app to write on that machine, no problem.
Very strange...
>
> As long as i use tomcat to write to dir out of tomcat home dir, it has
> problem, i was trying to fix it without using catalina security manager
I don't think it is necessary simply because we have a webapp that
writes outside of Tomcat dir and that doesn't use it.
Try asking Tomcat's mailing list, maybe they have a solution. Also try
to write a simple servlet that writes in the same directory, so Tomcat
list people cannot say "It's a Struts issue" :-)
Sorry for not being helpful
Ciao
Antonio
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Uploading problem
Posted by Antonio Petrelli <br...@tariffenet.it>.
Li ha scritto:
> yes, /temp existed
>
> if i just use normal java app to write on that machine, no problem.
Very strange...
>
> As long as i use tomcat to write to dir out of tomcat home dir, it has
> problem, i was trying to fix it without using catalina security manager
I don't think it is necessary simply because we have a webapp that
writes outside of Tomcat dir and that doesn't use it.
Try asking Tomcat's mailing list, maybe they have a solution. Also try
to write a simple servlet that writes in the same directory, so Tomcat
list people cannot say "It's a Struts issue" :-)
Sorry for not being helpful
Ciao
Antonio
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Uploading problem
Posted by Lintang JP <li...@gmail.com>.
-R in capital
chmod -r 777 /temp
On 7/26/06, Irwan Nurwandi <ir...@gmail.com> wrote:
>
> in shell console :
> 1. login as root
> 2. execute :
>
> chmod -r 777 /temp
>
> hope it work !
>
> Regards
> Irwan
>
> On 7/26/06, Li <am...@gmail.com> wrote:
> > yes, /temp existed
> >
> > if i just use normal java app to write on that machine, no problem.
> >
> > As long as i use tomcat to write to dir out of tomcat home dir, it has
> > problem, i was trying to fix it without using catalina security manager,
> you
> > have any exp on tomcat?
> >
> >
> > On 7/26/06, Antonio Petrelli <br...@tariffenet.it> wrote:
> > >
> > > Li ha scritto:
> > > > well,
> > > >
> > > > permission denied here means I had found the temp dir but can not
> > > > write to
> > >
> > > Probably your right: it seems (at least under windows) that the parent
> > > of the root is the root itself, so the final directory will be
> "/temp".
> > > Does "/temp" exist? And can you write into it?
> > >
> > > Ciao
> > > Antonio
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
> >
> > --
> > When we invent time, we invent death.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
-------------------------------------------------------------------
Laboratorium Pemrograman Kehidupan
Kavling Bumi, Galaksi Bimasakti
D.u.n.i.a
#365364 Registered Linux User
Re: Uploading problem
Posted by Irwan Nurwandi <ir...@gmail.com>.
in shell console :
1. login as root
2. execute :
chmod -r 777 /temp
hope it work !
Regards
Irwan
On 7/26/06, Li <am...@gmail.com> wrote:
> yes, /temp existed
>
> if i just use normal java app to write on that machine, no problem.
>
> As long as i use tomcat to write to dir out of tomcat home dir, it has
> problem, i was trying to fix it without using catalina security manager, you
> have any exp on tomcat?
>
>
> On 7/26/06, Antonio Petrelli <br...@tariffenet.it> wrote:
> >
> > Li ha scritto:
> > > well,
> > >
> > > permission denied here means I had found the temp dir but can not
> > > write to
> >
> > Probably your right: it seems (at least under windows) that the parent
> > of the root is the root itself, so the final directory will be "/temp".
> > Does "/temp" exist? And can you write into it?
> >
> > Ciao
> > Antonio
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
> --
> When we invent time, we invent death.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Uploading problem
Posted by Li <am...@gmail.com>.
yes, /temp existed
if i just use normal java app to write on that machine, no problem.
As long as i use tomcat to write to dir out of tomcat home dir, it has
problem, i was trying to fix it without using catalina security manager, you
have any exp on tomcat?
On 7/26/06, Antonio Petrelli <br...@tariffenet.it> wrote:
>
> Li ha scritto:
> > well,
> >
> > permission denied here means I had found the temp dir but can not
> > write to
>
> Probably your right: it seems (at least under windows) that the parent
> of the root is the root itself, so the final directory will be "/temp".
> Does "/temp" exist? And can you write into it?
>
> Ciao
> Antonio
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
When we invent time, we invent death.
Re: Uploading problem
Posted by Antonio Petrelli <br...@tariffenet.it>.
Li ha scritto:
> well,
>
> permission denied here means I had found the temp dir but can not
> write to
Probably your right: it seems (at least under windows) that the parent
of the root is the root itself, so the final directory will be "/temp".
Does "/temp" exist? And can you write into it?
Ciao
Antonio
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Uploading problem
Posted by Li <am...@gmail.com>.
well,
permission denied here means I had found the temp dir but can not write to
On 7/26/06, Antonio Petrelli <br...@tariffenet.it> wrote:
>
> Li ha scritto:
> > java.io.FileNotFoundException: /var/../../temp/test123.jpg (Permission
> > denied)
>
> Uh I think it is simply a wrong path, see what was written
> /: start at root
> var: you are in /var
> ..: you are back in root
> .. (again): WTF? the parent of the root?
> Check how you calculate the destination path.
>
> HTH
> Antonio
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
When we invent time, we invent death.
Re: Uploading problem
Posted by Antonio Petrelli <br...@tariffenet.it>.
Li ha scritto:
> java.io.FileNotFoundException: /var/../../temp/test123.jpg (Permission
> denied)
Uh I think it is simply a wrong path, see what was written
/: start at root
var: you are in /var
..: you are back in root
.. (again): WTF? the parent of the root?
Check how you calculate the destination path.
HTH
Antonio
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Uploading problem
Posted by Li <am...@gmail.com>.
Hi, Antonio,
I was tring to write the test123.jpg file, but when creating
FileOutputStream object,
it failed to access the ../temp dir, which is existed. temp dir had already
been given the write access
java.io.FileNotFoundException: /var/../../temp/test123.jpg (Permission
denied)
On 7/26/06, Antonio Petrelli <br...@tariffenet.it> wrote:
>
> Li ha scritto:
> > Hi all,
> >
> > When I was trying to upload from my local machine. uploading failed.
> > ...
> >
> > Any idea?
>
> Check the logs and eventually stack traces, then return here and post
> any suspicious log.
>
> Ciao
> Antonio
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
When we invent time, we invent death.
Re: Uploading problem
Posted by Antonio Petrelli <br...@tariffenet.it>.
Li ha scritto:
> Hi all,
>
> When I was trying to upload from my local machine. uploading failed.
> ...
>
> Any idea?
Check the logs and eventually stack traces, then return here and post
any suspicious log.
Ciao
Antonio
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org