How to set Permissions on New File

From: Hal Vaughan (hal_at_thresholddigital.com)
Date: 10/28/03


Date: Tue, 28 Oct 2003 05:11:02 GMT

I've been reading up on file permissions (including FilePermission,
Permission, and Permissions). From what I see, these are temporary and
forgotten when a program exits (if I'm wrong, tell me, please).

I'm installing a program on a computer and that includes configuration files
that change regularly. When I create the configuration files, I want them
to be readable and writable by any user running the program, otherwise my
program won't be able to function.

So how can I, from Java, find a way to set the permissions on a file I
create (from within Java) so all users can read and write that file
whenever they run the program?

My first thought was to have the program itself, whenever it was started,
set the permissions with a FilePermission object, but that doesn't make
sense -- if files are not readable or writable by a user, it wouldn't make
sense to allow that user to change the permissions.

Thanks for any info.

Hal



Relevant Pages

  • =?iso-8859-1?q?=DCber_Javascript_eine_Funktion_im_Applet_ausf=FChren,_die_eine_Datei_schreib
    ... ich habe ein Applet das eine Datei schreibt. ... Funktion über JavaScript aufrufen. ... Leider bekomme ich Probleme bei den Permissions. ... brauche ich außer FilePermission? ...
    (de.comp.lang.java)
  • Re: jdbc permissions
    ... Using the SQL Server 2000 Driver for JDBC on a Java 2 Platform ... additional permissions. ...
    (microsoft.public.sqlserver.server)
  • Re: [Full-Disclosure] Unsecure file permission of ZoneAlarm pro.
    ... to set these permissions like this. ... From now on, I will use this folder to produce exploits against ZAP, ... unlikely that it can protect against every conceivable unknown threat, ... Configuration files are protected ...
    (Full-Disclosure)
  • Re: Java checkbox missing in IE6 internet options
    ... Johan - Glad to hear you got your Java working. ... there are MVPs in the WMP newsgroup that would be able to offer ... in the permissions field, there was no info whatsoever in the permissions. ... work correctly for *.mpg and *.wmv files. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Code Access Security [Was .NET Framework Security Projects]
    ... > Comparing the granularity of security would be interesting. ... > in UIs, plus when I started, there was a mentality of "It's Java, so it's ... Defines permissions and permission sets that represent the right to ... Enables code to demand that its callers have specific permissions. ...
    (microsoft.public.dotnet.security)