ESP32 FTP Server won't keep connected

I’ve been trying to start a FTP Server from ESP32 following this example:

https://platformio.org/lib/show/6015/ESP32FTPServer

Im using FileZilla in Windows 10 as well in Mac OS.
In FileZilla I always get:

|Estado:     |Conectando 192.168.5.101:21...|
|---|---|
|Estado:     |Conexão estabelecida, esperando mensagem de boas-vindas...|
|Resposta: |220--- Welcome to FTP for ESP32 ---|
|Resposta: |220---   By David Paiva   ---|
|Resposta: |220 --   Version FTP-2016-01-14   --|
|Comando: |AUTH TLS|
|Resposta: |500 Syntax error|
|Comando: |AUTH SSL|
|Resposta: |530 user not found|
|Estado:     |Servidor sem segurança, não suporta FTP sobre TLS.|
|Comando: |USER base|
|Erro:         |Não foi possível ler do soquete: ECONNRESET - Conexão redefinida|
|Erro:         |Não foi possível conectar ao servidor|

Simultaneously, by ESP32’s side, I get:

Client connected!
AUTH TLS
Disconnecting client
Ftp server waiting for connection on port 21

What might be happening?

Now I’m testing as alternative:
https://platformio.org/lib/show/10921/ESP-FTP-Server-Lib

But again no success achieved!
In FileZilla:
|Estado: |Conectando 192.168.5.101:21…|
|—|—|
|Estado: |Conexão estabelecida, esperando mensagem de boas-vindas…|
|Estado: |Servidor sem segurança, não suporta FTP sobre TLS.|
|Estado: |O servidor não suporta caracteres que não sejam ASCII.|
|Estado: |Identificado|
|Estado: |Obtendo lista de pastas…|
|Comando: |PWD|
|Resposta: |257 / is your current directory|
|Comando: |TYPE I|
|Resposta: |200 TYPE is now 8-bit binary|
|Comando: |PASV|
|Resposta: |500 Unknown command|
|Comando: |PORT 192,168,5,119,217,224|
|Resposta: |200 PORT command successful|
|Comando: |MLSD|
|Resposta: |150 Accepted data connection|
|Resposta: |550 Can’t open directory /|
|Erro: |Falha na obtenção da lista de pastas|

In Serial Monitor:

AUTH TLS
USER: 500 Unknown command
AUTH SSL
USER: 500 Unknown command
USER base
PASS dados
PWD
TYPE I
PASV
500 Unknown command
PORT 192,168,5,119,217,224
MLSD

Using the peterus/ESP-FTP-Server-Lib library works, but it’s unintuitive for the FTP client because the default sketch does not populalate the / directory. When the code does

(I commented out all the SD code in my case), you have to access the sub-filesystems by their explicit paths, so e.g., /SPIFFS. With that, FileZilla shows me the contents of the SPIFFS partition that I uploaded to the microcontroller previously.

And that works.

Either improve the library or file a report in Issues · peterus/ESP-FTP-Server-Lib · GitHub for the author.

Now it works… Thank you.

I’ve tried it first commenting out “SD” and then with both SD and SPIFFS enabled. But it shows a strange behavior and I can’t be sure whether it happens in FileZilla or in ESP32 FTP filesystem itself.

The problem is that FileZilla isn’t able to step back opened folders. I mean, for example, when /SD/Teste04 folder is opened, like this:
image

I can’t go back to /SD folder. It reports an error:
image

image

image

I guess the issue might be in ESP32 FTP itself, because FileZilla delivers “CWB /SD” command and ESP32 answers “/sd/Teste04/SD does not exist”.

The only solution I found so far is to reconnect, but with preset remote folder:
image

Any clue?

The FTP server implementation can definitely be better. Either do per above

or find an alternative library

Done.
Here you are the GitHub issue link. Maybe someone would like to follow it too.
https://github.com/peterus/ESP-FTP-Server-Lib/issues/8

Thank you.
Regards,
Ciro.

1 Like