521 data connection cannot be opened with this PROT setting

donj91711

2011-01-11 22:00:14

Hello, I am connecting to a secure FTP site. The connection goes ok, but when I try to either upload a file or read directory contents it dies with "521 data connection cannot be opened with this PROT setting". Below is the code and the log. Thank you for any light you can shed on this for me:

Public objFTP As sfFTPLib.FTPConnectionSTA
Set objFTP = CreateObject("sfFTPLib.FTPConnectionSTA")

objFTP.Host = "[myFTPsite.com]"
objFTP.Username = "[myuser]"
objFTP.Password = "[mypass]"
objFTP.Port = 21
objFTP.Protocol = ftpProtocolSSLExplicit
objFTP.Passive = True
objFTP.LogFile.File = "SmartFTP.log"
If objFTP.Connect = sfFTPLib.enumError.ftpErrorSuccess Then
If objFTP.ReadDirectory() = sfFTPLib.enumError.ftpErrorSuccess Then
'read directory info here - it dies on the read directory line.
'it also dies if I try to objFTP.UploadFile(FileName, FileName, 0, 0)
end if
end if

*** log ***
[20110111 21:47:57] SmartFTP FTP Library 2.0.86.0
[20110111 21:47:58] Resolving host name "[myFTPSite.com]"
[20110111 21:47:58] Connecting to [MY_IP] Port: 21
[20110111 21:47:58] Connected to [myFTPsite.com].
[20110111 21:47:59] 220-You are authorized to use this System for approved business purposes only.

[20110111 21:47:59] 220-Use for any other purpose is prohibited. All transactional records, reports,

[20110111 21:47:59] 220-e-mail, software, and other data generated by or residing upon this System

[20110111 21:47:59] 220-are the property of the Company and may be used by the Company for any purpose.

[20110111 21:47:59] 220-Authorized and unauthorized activities may be monitored.
[20110111 21:47:59] 220-
[20110111 21:47:59] 220 [myinfo] FTP server (SecureTransport 4.7) ready.
[20110111 21:47:59] AUTH TLS
[20110111 21:47:59] 234 SSLv23/TLSv1
[20110111 21:48:00] TLS 1.0 encrypted session established.
[20110111 21:48:00] Key Exchange: 1024 bit RSA
[20110111 21:48:00] Session Cipher: 128 bit RC4
[20110111 21:48:00] Command channel protection set to Private.
[20110111 21:48:00] PBSZ 0
[20110111 21:48:00] 200 PBSZ=0
[20110111 21:48:00] USER [my login]
[20110111 21:48:00] 331 Password required for [my login].
[20110111 21:48:00] PASS [my pass]
[20110111 21:48:04] 230 Virtual user [my login] logged in.
[20110111 21:48:04] SYST
[20110111 21:48:04] 215 UNIX Type: L8
[20110111 21:48:04] Detected Server Type: UNIX
[20110111 21:48:04] RTT: 84.751 ms
[20110111 21:48:04] FEAT
[20110111 21:48:04] 211-Extensions supported
[20110111 21:48:04] AUTH
[20110111 21:48:04] USER
[20110111 21:48:04] PASS
[20110111 21:48:04] QUIT
[20110111 21:48:04] PORT
[20110111 21:48:04] PASV
[20110111 21:48:04] EPSV
[20110111 21:48:04] TYPE
[20110111 21:48:04] STRU
[20110111 21:48:04] MODE
[20110111 21:48:04] RETR
[20110111 21:48:04] STOR
[20110111 21:48:04] ABOR
[20110111 21:48:04] DELE
[20110111 21:48:04] CWD
[20110111 21:48:04] XCWD
[20110111 21:48:04] LIST
[20110111 21:48:04] NLST
[20110111 21:48:04] SITE
[20110111 21:48:04] SYST
[20110111 21:48:04] STAT
[20110111 21:48:04] HELP
[20110111 21:48:04] NOOP
[20110111 21:48:04] MKD
[20110111 21:48:04] XMKD
[20110111 21:48:04] RMD
[20110111 21:48:04] XRMD
[20110111 21:48:04] PWD
[20110111 21:48:04] XPWD
[20110111 21:48:04] CDUP
[20110111 21:48:04] XCUP
[20110111 21:48:04] SIZE
[20110111 21:48:04] MDTM
[20110111 21:48:04] RNFR
[20110111 21:48:04] RNTO
[20110111 21:48:04] REST
[20110111 21:48:04] FEAT
[20110111 21:48:04] ADAT
[20110111 21:48:04] PROT
[20110111 21:48:04] PBSZ
[20110111 21:48:04] APPE
[20110111 21:48:04] XCRC
[20110111 21:48:04] CCC
[20110111 21:48:04] COMB
[20110111 21:48:04] UTF8
[20110111 21:48:05] 211 END
[20110111 21:48:05] OPTS UTF8 ON
[20110111 21:48:05] 500 'OPTS UTF8 ON': command not understood.
[20110111 21:48:05] PWD
[20110111 21:48:05] 257 "/" is current directory.
*** works fine up to this point, then I try to get a file or read the contents of a directory, then it gives me the below ***
[20110111 21:49:14] TYPE I
[20110111 21:49:14] 200 Type set to I.
[20110111 21:49:14] PROT C
[20110111 21:49:14] 200 PROT command successful
[20110111 21:49:14] PASV
[20110111 21:49:14] 227 Entering Passive Mode (192,193,232,30,80,105)
[20110111 21:49:14] Opening data connection to 192.193.232.30 Port: 20585
[20110111 21:49:14] LIST
[20110111 21:49:14] 521 data connection cannot be opened with this PROT setting

mb

2011-01-11 22:01:10

Please add your license key id to your profile in this forum.

donj91711

2011-01-11 22:12:45

When I try to go to my profile on the menu at the top it says:

403 - Forbidden: Access is denied.
You do not have permission to view this directory or page using the credentials that you supplied.

mb

2011-01-11 23:55:22

You need to set the DataProtection to private:
objFTP.DataProtection = ftpDataProtectionPrivate ' numeric 2

donj91711

2011-01-12 00:15:49

Thanks for you help - that fixed it.