1

When I try to connect to my ftp server through winscp, I get the "Illegal port command" error first time and it was happening when it was listing root(/) directory files. I'm not sure how to get-rid of this error , have been checking source script (Presuming there is some init script)but couldn't find right source or links to explore.

Copied log context for reference.

FYI: FileZilla works fine without any issues. Please shed some light on the issue!

. 2018-01-08 08:57:09.656 --------------------------------------------------------------------------
. 2018-01-08 08:57:09.656 WinSCP Version 4.2.7 (Build 758) (OS 6.1.7601 Service Pack 1)
. 2018-01-08 08:57:09.656 Login time: Monday, January 08, 2018 8:57:09 AM
. 2018-01-08 08:57:09.656 --------------------------------------------------------------------------
. 2018-01-08 08:57:09.656 Session name: test@myuploads.com
. 2018-01-08 08:57:09.656 Host name: myuploads.com (Port: 21)
. 2018-01-08 08:57:09.656 User name: test (Password: Yes, Key file: No)
. 2018-01-08 08:57:09.656 Tunnel: No
. 2018-01-08 08:57:09.656 Transfer Protocol: FTP
. 2018-01-08 08:57:09.656 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2018-01-08 08:57:09.656 Proxy: none
. 2018-01-08 08:57:09.656 FTP: FTPS: Explicit TLS; Passive: No [Force IP: No]
. 2018-01-08 08:57:09.656 Local directory: C:\Users\Administrator\Documents, Remote directory: /, Update: Yes, Cache: Yes
. 2018-01-08 08:57:09.656 Cache directory changes: Yes, Permanent: Yes
. 2018-01-08 08:57:09.656 DST mode: 1
. 2018-01-08 08:57:09.656 --------------------------------------------------------------------------
. 2018-01-08 08:57:09.671 Connecting to myuploads.com ...
. 2018-01-08 08:57:09.671 m_pSslLayer changed state from 0 to 1
. 2018-01-08 08:57:09.671 m_pSslLayer changed state from 1 to 2
. 2018-01-08 08:57:09.671 m_pSslLayer changed state from 2 to 4
. 2018-01-08 08:57:09.671 Connected with myuploads.com, negotiating SSL connection...
< 2018-01-08 08:57:09.671 220 (vsFTPd 3.0.2)
> 2018-01-08 08:57:09.671 AUTH TLS
< 2018-01-08 08:57:09.671 234 Proceed with negotiation.
. 2018-01-08 08:57:09.827 SSL_connect: SSLv3 read server hello A
. 2018-01-08 08:57:09.827 SSL_connect: SSLv3 read server certificate A
. 2018-01-08 08:57:09.827 SSL_connect: SSLv3 read server key exchange A
. 2018-01-08 08:57:09.827 SSL_connect: SSLv3 read server certificate request A
. 2018-01-08 08:57:09.827 SSL_connect: SSLv3 read server done A
. 2018-01-08 08:57:09.827 SSL_connect: SSLv3 write client certificate A
. 2018-01-08 08:57:09.827 SSL_connect: SSLv3 write client key exchange A
. 2018-01-08 08:57:09.827 SSL_connect: SSLv3 write change cipher spec A
. 2018-01-08 08:57:09.827 SSL_connect: SSLv3 write finished A
. 2018-01-08 08:57:09.827 SSL_connect: SSLv3 flush data
. 2018-01-08 08:57:09.827 SSL_connect: SSLv3 read finished A
. 2018-01-08 08:57:09.827 Using TLSv1, cipher TLSv1/SSLv3: DHE-RSA-AES256-SHA, 2048 bit RSA
. 2018-01-08 08:57:09.827 SSL connection established. Waiting for welcome message...
> 2018-01-08 08:57:09.827 USER test
< 2018-01-08 08:57:09.827 331 Please specify the password.
> 2018-01-08 08:57:09.827 PASS ******
< 2018-01-08 08:57:09.858 230 Login successful.
> 2018-01-08 08:57:09.952 SYST
< 2018-01-08 08:57:09.952 215 UNIX Type: L8
> 2018-01-08 08:57:09.952 FEAT
< 2018-01-08 08:57:09.952 211-Features:
< 2018-01-08 08:57:09.952  AUTH TLS
< 2018-01-08 08:57:09.952  EPRT
< 2018-01-08 08:57:09.952  EPSV
< 2018-01-08 08:57:09.952  MDTM
< 2018-01-08 08:57:09.952  PASV
< 2018-01-08 08:57:09.952  PBSZ
< 2018-01-08 08:57:09.952  PROT
< 2018-01-08 08:57:09.952  REST STREAM
< 2018-01-08 08:57:09.952  SIZE
< 2018-01-08 08:57:09.952  TVFS
< 2018-01-08 08:57:09.952  UTF8
< 2018-01-08 08:57:09.952 211 End
> 2018-01-08 08:57:09.952 OPTS UTF8 ON
< 2018-01-08 08:57:09.952 200 Always in UTF8 mode.
> 2018-01-08 08:57:09.952 PBSZ 0
< 2018-01-08 08:57:09.952 200 PBSZ set to 0.
> 2018-01-08 08:57:09.952 PROT P
< 2018-01-08 08:57:09.952 200 PROT now Private.
. 2018-01-08 08:57:09.952 Connected
. 2018-01-08 08:57:09.952 Got reply 1 to the command 1
. 2018-01-08 08:57:09.952 --------------------------------------------------------------------------
. 2018-01-08 08:57:09.952 Using FTP protocol.
. 2018-01-08 08:57:09.952 Doing startup conversation with host.
> 2018-01-08 08:57:09.952 PWD
< 2018-01-08 08:57:09.952 257 "/"
. 2018-01-08 08:57:09.952 Got reply 1 to the command 16
. 2018-01-08 08:57:09.952 Changing directory to "/".
> 2018-01-08 08:57:09.952 CWD /
< 2018-01-08 08:57:09.952 250 Directory successfully changed.
. 2018-01-08 08:57:09.952 Got reply 1 to the command 16
. 2018-01-08 08:57:09.952 Getting current directory name.
> 2018-01-08 08:57:09.952 PWD
< 2018-01-08 08:57:09.952 257 "/"
. 2018-01-08 08:57:09.952 Got reply 1 to the command 16
. 2018-01-08 08:57:09.952 Retrieving directory listing...
> 2018-01-08 08:57:09.952 TYPE A
< 2018-01-08 08:57:09.952 200 Switching to ASCII mode.
> 2018-01-08 08:57:09.952 PORT 10,0,40,181,244,221
< 2018-01-08 08:57:09.952 500 Illegal PORT command.
. 2018-01-08 08:57:09.952 Could not retrieve directory listing
. 2018-01-08 08:57:09.952 Got reply 4 to the command 2
. 2018-01-08 08:57:09.968 Retrieving directory listing...
> 2018-01-08 08:57:09.968 TYPE A
< 2018-01-08 08:57:09.968 200 Switching to ASCII mode.
> 2018-01-08 08:57:09.968 PORT 10,0,40,181,244,222
< 2018-01-08 08:57:09.968 500 Illegal PORT command.
. 2018-01-08 08:57:09.968 Could not retrieve directory listing
. 2018-01-08 08:57:09.968 Got reply 4 to the command 2
* 2018-01-08 08:57:09.968 (ECommand) Error listing directory '/'.
* 2018-01-08 08:57:09.968 Could not retrieve directory listing
* 2018-01-08 08:57:09.968 Illegal PORT command.
. 2018-01-08 08:57:27.159 Startup conversation with host finished.
. 2018-01-08 08:57:27.798 Session upkeep
. 2018-01-08 08:57:28.313 Session upkeep
1

You have configured WinSCP to use an active FTP mode.

I'm pretty sure, you use a passive mode in FileZilla.

Make sure you re-enable the passive mode in WinSCP: https://winscp.net/eng/docs/ui_login_connection

Read WinSCP article about active/passive mode to understand why active mode is a problematic one.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.