Search code examples
coldfusionftpsftpcoldfusion-9ftps

ColdFusion Version 9 Secure FTP - Unable to Connect


I am looking to automate something that is currently being done manually. The manual process is being performed using ftp client Filezilla. These are the instructions:

In the Host field, type in the IP address: xx.xxx.xxx.xxx.
In the Port field, type in 990.
In the Servertype dropdown list, change it so that it reads 
 FTP over SSL/TLS (implicit encryption). (NOTE: On the Mac OSX 
 version this option will read FTPS – FTP over implicit TLS/SSL).
In the Logontype area, select Normal.
In the Username field, enter your username.
In the Password field, enter your password.

When I follow those instructions, I connect successfully. This is what I tried in ColdFusion:

<cfftp action="open"
connection="abc"
secure = true
server="something valid"
port="990"
username="something valid" 
password="something valid">

This is the error message: An error occurred while establishing an sFTP connection. Verify your connection attributes: username, password, server, fingerprint, port, key, connection, proxyServer, and secure (as applicable). Error: Session.connect: java.net.SocketTimeoutException: Read timed out.

When I remove the port attibute, the result is unchanged. When I change the username to something not valid, I get a slightly different error: An error occurred while establishing an sFTP connection. Verify your connection attributes: username, password, server, fingerprint, port, key, connection, proxyServer, and secure (as applicable). Error: connection is closed by foreign host.

In other words, the timeout is replaced by an intentional closure.

What should I be looking at in order to sort this out?


Solution

  • Your creating a FTPS connection in Filezilla, and ColdFusion 9 doesn’t have native support for FTPS, only SFTP. Thanks to abbottmw answer I was able to create an Explicit FTPS connection in the past. ColdFusion 9 ships with the Apache Commons library and you can create the connection on the java level with FTPSClient.