This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using setPermission  RSS feed

Nick Keay
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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)?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!