I'm running a FTP server with the below python code in a docker container on windows 10.
import os
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
FTP_PORT = 8080
FTP_USER = "test"
FTP_PASSWORD = "test"
FTP_DIRECTORY = "/root/srv/ftp"
def main():
authorizer = DummyAuthorizer()
authorizer.add_user(FTP_USER, FTP_PASSWORD, FTP_DIRECTORY, perm='elradfmw')
handler = FTPHandler
handler.authorizer = authorizer
handler.banner = "pyftpdlib based ftpd ready."
#handler.passive_ports = range(60000, 65535)
address = ('', FTP_PORT)
server = FTPServer(address, handler)
server.max_cons = 256
server.max_cons_per_ip = 5
server.serve_forever()
if __name__ == '__main__':
main()
When I tried to upload a file to this FTP server it is failing with below statement.
curl -T test.txt ftp://localhost:8080/ --user test:test
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:04 --:--:-- 0
curl: (7) Failed to connect to localhost port 8080 after 4040 ms: Couldn't connect to server
Below are the docker logs.
2023-08-04 12:46:37 [I 2023-08-04 07:06:37] 172.11.52.1:56758-[] FTP session opened (connect)
2023-08-04 12:46:37 [I 2023-08-04 07:06:37] 172.11.52.1:56758-[test] USER 'test' logged in.
2023-08-04 12:46:41 [I 2023-08-04 07:06:41] 172.11.52.1:56758-[test] FTP session closed (disconnect).
Please help me fix this.