Closed Liberasys closed 6 years ago
I have added NLST
command to FTP server and a few other changes.
lftp. mirror
command now works, I have to test it more and will commit when ready.
Great ! After that, do you want that I provide the bash script with a small help in order to integrate it in your repository and/or wiki ? I must say that ntp_sync + time properties in filesystem + FTP mirror based on files dates will be a must :-)
The ftp server is now updated.
Not fully tested with lftp mirror
command, so you should be carefull...
Tested with Ftp-Remote package on Atom editor seems to be working fine.
For information, AUTH TLS leads to problems (known issue). Some information: network capture:
220 Micropython FTP Server FEAT 502 no-features AUTH TLS 332 ...........Z}w|.y.......@..p..e....4 ........r.,....... .$.s.+..... .#.r...0.......(.w./.....'.v.....{...5.=.......z.../.<.A... ...}.....9.k.......|...3.g.E.......b..........................192.168.205.101......#... ... ................. ........................332
Firmware problem:
W (21757) [Ftp]: FTP RESET W (21760) [Ftp]: Error sending command reply.
I confirm it is OK with lftp now ! Thank you Boris !!! :-) If it can help, you will find here under my small script for syncing local "./filesystem" folder to "/flash/" folder on ESP32. It is very practical for developing.
First you have to do this with ESP32:
In the script, change the IP of your ESP32, the source folder and you are good for basic setup.
`#!/bin/bash HOST='ftp://192.168.205.101' USER='micro' PASS='python' TARGETFOLDER='/flash/' SOURCEFOLDER='./filesystem/'
lftp -f " set ftp:passive-mode yes set ftp:ssl-allow no open ${HOST} user ${USER} ${PASS} lcd ${SOURCEFOLDER} mirror --scan-all-first --reverse --delete --verbose --exclude config.json --parallel=1 ./ ${TARGETFOLDER} bye " `
I have added the negative response to AUTH
command
If the client tries to establish the secure connection sending AUTH TLS
command, the AUTH TLS
will be rejected by the server and lftp will continue with unsecure connection.
So, there is no need any more to set set ftp:ssl-allow no
.
boris@UbuntuMate:~$ lftp -d
lftp :~> open 192.168.0.16
---- Resolving host address...
---- 1 address found: 192.168.0.16
lftp 192.168.0.16:~> user micro python
lftp micro@192.168.0.16:~> ls
---- Connecting to 192.168.0.16 (192.168.0.16) port 21
<--- 220 Micropython FTP Server
---> FEAT
<--- 502 no-features
---> AUTH TLS
<--- 504 not-supported
---> USER micro
<--- 331
---> PASS python
<--- 230
---> PWD
<--- 257 /
---> PASV
<--- 227 (192,168,0,16,7,232)
---- Connecting data socket to (192.168.0.16) port 2024
---- Data connection established
---> LIST
<--- 150
drw-rw-rw- 1 root root 0 Feb 09 2018 flash
---- Got EOF on data connection
---- Closing data socket
<--- 226
lftp micro@192.168.0.16:~>
This change will be committed on the next update.
Thenks for the script, I'll include it in the Wiki.
Perfect, thank you Boris ! I'm happy to help a bit in return :-)
Just a "quick start" example in more, for testers in the hurry or beginners (wahooo effect :-) :
# connect to a WIFI AP, sync time and start telnet and FTP server
# Paste it in the Python command line (REPL)
# Then you can connect to the IP of your ESP32 in FTP (passive mode) or in telnet !
wifi_ssid = "my_home_ssid"
wifi_passwd = "my_wifi_password"
my_timezone = "CET-1CEST" # found in second field, text before the coma, in https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo/blob/master/MicroPython_BUILD/components/micropython/docs/zones.csv
import network
import machine
import time
sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
sta_if.connect(wifi_ssid, wifi_passwd)
time.sleep(6)
sta_if.ifconfig()
rtc = machine.RTC()
rtc.init((2018, 01, 01, 12, 12, 12))
rtc.ntp_sync(server= "", tz=my_timezone, update_period=3600)
network.ftp.start(user="micro", password="python", buffsize=1024, timeout=300)
network.telnet.start(user="micro", password="python", timeout=300)
print("IP of this ESP32 is : " + sta_if.ifconfig()[0])
Hello Boris,
I still have some problems with lftp. First, when TLS feature is negociated, the FTP server crashes:
Secondly, lftp mirrorring is still not functionnal. I join you the lftp script I made and the wireshark capture. I think that the NLST command is not managed by FTP server.
Anyway file transfert with filezilla is OK. But an automatic sync with lftp would be perfect to me :-) For information I found lemariva ftp server code which works well with lftp : https://github.com/lemariva/uPyPortal/blob/master/ftp.py Maybe you could find some usefull information in it ?