A co-worker is trying to use cfftp to transfer a file between two computers. The code they have written connects to the remote machine "Connection Open? Yes", in the desired remote location, and displays the content in the remote location. However, attempts to "put" a file fail with an "Access is Denied" error. This process can be successfully performed, using the same credentials, with WinSCP. "Passive=yes" and "no" have been tried. This is on CF2018 Standard, connecting to IIS 10 on WS2019 Standard Ed. Any suggestions would be appreciated.
FTP is the worst protocol ever. That said, you're probably going to have to use some monitoring tools to figure out the problem here. If you're using FTP rather than SFTP/FTPS, this will be a little easier. Use Wireshark on one of the two machines to figure out what's different between the two connections. I'm sorry I can't be more clear than that, because I honestly don't know what you'd be looking for except for some difference between them.
Dave Watts, Eidolon LLC
I have a couple more thoughts: you say you have demonstrated it “works” with WinSCP. Let’s make sure it’s truly an equal comparison.
1) First, we’ll assume you are using the same username/password in CF as in that, right?
2) And all the same connection settings? 100% positive? You (we) might presume the server and port “must be the same” since you could make the connection, but it’s not necessarily so (it could point to some other “almost working” server), so it’s worth double-checking. And good catch on the passive or not: I assume you’re saying that whatever winscp is using, CF is.
Just make sure there’s not any other setting that CF could control which may differ (in defaults or set on the cfftp) from what that winscp is doing. Dave mentioned SFTP and FTPS as other possible examples. We just want to make sure you really are comparing apples and apples.
3) Finally, as yet another sanity check, can you confirm if you ran winscp from the SAME BOX as CF? You may think it would not matter, but perhaps it could.
Just trying to help you rule out that it can’t be something totally unexpected in your comparison of why it “fails” in CF but “works” in winscp.
Let us know how it goes.
Could you possibly share the cfftp code. In any case, with "access denied" I would suggest the following checks.
1) Ensure that the user credentials used in opening the connection have read/write permissions on the folder where the file is to be put;
2) Ensure that the ColdFusion server and FTP server are interpreting filepaths in the same way. Take, for example
<cfftp connection = "myConnection"
action = "putFile"
name = "uploadFile"
transferMode = "binary"
localFile = "C:\filesUploadDir\someDoc.pdf"
remoteFile = "someDocPut.pdf">
Are the values for localFile and remoteFile correct? Do you need to use "/" somewhere instead of "\"?