#!python # -*- mode: python; Encoding: utf-8; coding: utf-8 -*- # Last updated: <2023/06/19 03:50:51 +0900> """ FTP server example. Please access 127.0.0.1:21 Module install : pip install pyftpdlib Windows10 x64 22H2 + Python 3.10.10 64bit """ import pyftpdlib.authorizers import pyftpdlib.handlers import pyftpdlib.servers wwwdir = "D:\\home\\prg\\python\\_test_sample\\ftp\\www" # 認証ユーザーを作る authorizer = pyftpdlib.authorizers.DummyAuthorizer() authorizer.add_user('user', 'password', wwwdir, perm='elradfmw') # 個々の接続を管理するハンドラーを作る handler = pyftpdlib.handlers.FTPHandler handler.authorizer = authorizer # FTPサーバーを立ち上げる server = pyftpdlib.servers.FTPServer(("127.0.0.1", 21), handler) server.serve_forever()