Yes you can - use FilePermission of the java.io package. You can set read,
write, execute and delete permission separately or all at once by passing
the appropriate string to the constructor. But your question seems to more
oriented around ownership of the files. I don't know of a way (except maybe
through an exec, but that limits your code to a particular platform) to do
the equivalent of chown in Unix with Java.
Cheers!
Mark
----- Original Message -----
From: "Matthew L. Penner" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 11, 2001 6:01 PM
Subject: Re: Managing file permissions from servlets
> I'm not sure how you have your system set up but I am running on tomcat
with
> Redhat using virtual domains. Each domain has their own JVM which allows
> more control for the users. Since each user is administering their own
JVM
> when they start and stop the tomcat engine it uses their username.
> Therefore any files they create take on their own permissions.
>
> I'm not sure if you can set permissions with the File object but if not
you
> could exec chmod or something similar if you're on Linux.
>
> Just a thought, but their probably is a better solution for more developed
> systems.
>
> Matt
>
> On Wed, 11 Jul 2001, Duane Morse wrote:
>
> > Is there a standard approach to dealing with file permissions for files
> > created by servlets? With JRun, files my servlets
> > create are owned by me if I bring up JRun by hand, or they are owned by
root
> > if I bring up JRun through the admin console.
> > I know that Java itself doesn't deal with file permissions, but
somebody's
> > got to address the issue. The obvious solutions
> > are to either write native methods to deal with this (one set of native
> > methods per category of OS, I expect), or to
> > exec a system program from Java to straighten out permissions. Anybody
have
> > a better suggestion?
> >
> > Duane Morse, Eldorado Computing Inc., Phoenix, Arizona
> >
> >
___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html