You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Josh Rountree <ma...@carolina.rr.com> on 2007/07/27 20:22:25 UTC

Question about File ownership file upload and HTTP Post

I have a servlet that processes requests for file uploads. When I write this
file to disk, root is the owner? Is this the correct behavior? Since I do
not have root access on the machine that the servlet executes I cannot
remove these files. Any documentation that explains how to change the owner
of these uploaded files?

 

Thanks, Josh


No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.10.22/922 - Release Date: 7/27/2007
6:08 AM
 

Re: Question about File ownership file upload and HTTP Post

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Josh Rountree wrote:
> I have a servlet that processes requests for file uploads. When I write this
> file to disk, root is the owner? Is this the correct behavior? Since I do
> not have root access on the machine that the servlet executes I cannot
> remove these files. Any documentation that explains how to change the owner
> of these uploaded files?
>   
that is because your tomcat (java) process runs as root
you could write code to change the owner of the file after saving it to disk
Filip
>  
>
> Thanks, Josh
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition. 
> Version: 7.5.476 / Virus Database: 269.10.22/922 - Release Date: 7/27/2007
> 6:08 AM
>  
>
>   
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition. 
> Version: 7.5.476 / Virus Database: 269.10.19/917 - Release Date: 7/25/2007 1:16 AM
>   


---------------------------------------------------------------------
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: Question about File ownership file upload and HTTP Post

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

Josh,

Josh Rountree wrote:
> I have a servlet that processes requests for file uploads. When I
> write this file to disk, root is the owner?

You should not be running Tomcat as root. Are you doing that? Stop it!

> Is this the correct behavior?

Unless you do something special, the file will be owned by the user that
the Tomcat process is running as.

> Since I do not have root access on the machine that the servlet
> executes I cannot remove these files. Any documentation that explains
> how to change the owner of these uploaded files?

File ownership is one of those things that Java does not handle very
well. There's a bug report that's still in progress at Sun:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4313887

All the related documentation for this bug (and duplicates of it) says
to write your own native wrapper around the filesystem calls necessary.
Fortunately, such a wrapper would be very simple to write, if still a
pain in the neck to deploy, etc.

- -chris

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

iD8DBQFGqjxu9CaO5/Lv0PARAicgAJ9tk7IOC178TxPbJvTN1mGiGCv9CgCgmaYg
1cYKWzYugHEqrLCljCi5BkI=
=qWxD
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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