CFFTP - How to assign permissions to DIR or FILE

My code is below. This worked fine on ColdFusion. Once I moved the code over to Lucee, the assigning of the permissions stopped working – and caused an error.

So I can create a new directory, and I can upload a file to that directory just fine. But I can no longer assign file or directory permissions via:

testConn6.sendSiteCommand(“chmod 775 …”)

I’m guessing that Lucee does not use the same FTP client as CF so that “sendSiteCommand” does not exist.

Can anyone recommend a work-around to get this to work? Again, my goal is to:

  1. Create a directory (if it doesn’t exist)
    1-A) Assign “775” permissions to the newly created directory
  2. Upload a file to the newly created directory
  3. Assign “775” permissions to the file that was uploaded.

I cannot figure out how to assign file/directory permissions (via CFFTP) within Lucee.

<cfftp action = "open"
		  username = "#application.ftpUserName#"
		  connection = "testConn6"
		  password = "#application.ftpPwd#"
		  server = "#application.ftpServer#"

	 <cfftp connection = "testConn6"
	action = "existsDir"
	passive = "Yes">

	<cfif #cfftp.returnValue# eq "NO">
	   <cfftp connection = "testConn6"
	  action = "createDir"
	  passive = "Yes">
	 <cfscript>testConn6.sendSiteCommand("chmod 775 /var/www/html/common_images/ALIVERY/test2");</cfscript> 

	 <cfftp connection = "testConn6"
	action = "PutFile"
	passive = "Yes">
	<cfscript>testConn6.sendSiteCommand("chmod 775 /var/www/html/common_images/#client.confirmationprefix#/#driverimage#");</cfscript>

	<cfftp action="close" connection="testConn6" stopOnError="No" passive="Yes" />

Don’t forget to tell us about your stack!

OS: Linux (3.10.0-1160.36.2.el7.x86_64) 64bit
Java Version: 1.8.0_131 (Oracle Corporation) 64bit
Tomcat Version: Apache Tomcat/8.5.14
Lucee Version: Lucee

I’m not sure with this, but I’d try using fileSetAccessMode(). That’s a function from file handling and many protocols are supported for those (ssh, git, ftp, s3). Ftp should work using a common ftp uri as file location, containing also the credentiails… just the same way you would access your ftp files with a browser.

@fs8972 In ACF, CFFTP returns FTPClient class in connection name. But lucee didn’t does that. In lucee, we can assign permission for dir or file by using createObject().

/// <cfscript>testConn6.sendSiteCommand("chmod 775 /var/www/html/common_images/ALIVERY/test2");</cfscript>

ftpCl = createObject("java", "");
ftpcl.login(FTPusername, FTPpassword);
writeDump(var=ftpcl.sendSiteCommand("chmod 775 /var/www/html/common_images/ALIVERY/test2"),  label="sendSiteCommand");