It's not a secret anymore!
The moose likes Other Java Products and Servers and the fly likes Using setPermission Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Using setPermission" Watch "Using setPermission" New topic

Using setPermission

Nick Keay

Joined: Apr 02, 2012
Posts: 1

I'm using the apache ftp suite of packages for FTP'ing files over to a UNIX server from a Windows platform. After I've successfully got the file over to the Server, it has the following permission: "-rw-r--r--", which are User: Read Write, Group: Read, World: Read. I need the Group to have Read Write access to the files (for an Oracle process to pick it up).

So as a test I thought I’d loop over the directory, pick up my file, get the “hasPermission” to tell me what permissions it has then use “setPermission” to change it:

And this is what I get:

Got File: deenergised_001.txt
Has World Write permission: false
Has Group Write permission: false
Has User Write permission: true
Has Group Write permission: true

The problem is when I log back on to the UNIX Server, the file permissions remains as:

-rw-r--r-- 1 <username> users 97 Apr 2 12:21 deenergised_001.txt

What am I doing wrong? Is it only changing the permissions whilst the FTP session is in use (which would seem pretty useless)?
I agree. Here's the link:
subject: Using setPermission
It's not a secret anymore!