There IS a way to do it, because the ANT utility can take a chmod parameter
from the build.xml file and create the files with the specific permissions
you need.  The source code for ANT is at jakarta.apache.org/ant and you can
look for the specific method that does this.  Actually, if you find it, post
it here - it would be a really useful bean!

Cheers!
Mark

----- Original Message -----
From: "Duane Morse" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 11, 2001 7:04 PM
Subject: Re: Managing file permissions from servlets


> The basic problem is that I'd like to control programmatically the user,
> group, and "other"
> permissions for files my servlet creates, but since that is specifically a
> Unix set of
> attributes, I don't think the FilePermission class can help.  I don't want
> to rely on the
> user's own "umask" since that is usually too stringent.  Thanks for the
> suggestion, though.
> I started doing Java in the 1.0.2 days and had missed FilePermission when
it
> was
> introduced in the 1.2 release.
>
> Duane Morse, Eldorado Computing Inc., Phoenix, Arizona
>
>
> -----Original Message-----
> From: Mark Galbreath [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 11, 2001 3:52 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Managing file permissions from servlets
>
>
> 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
>
>
___________________________________________________________________________
> 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

Reply via email to