python --ftp server (pyftpdlib)

# -*- coding: utf-8 -*- 
# @Time : 2018/4/11 16:47
# @Author : liuxiaobing
# @File : test2.py
# @Software: PyCharm
# File download
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer

# Create a new user group
authorizer = DummyAuthorizer()
# Add username, password, specified directory, and permissions to it
authorizer.add_user("fan", "root", "D :/", perm="elr") # adfmw
# This is to add anonymous users, anyone can access, if you remove it, you need to enter the user name and password, you can try
authorizer.add_anonymous("D:/")

handler = FTPHandler
handler.authorizer = authorizer
# start server
server = FTPServer(("127.0.0.1", 21), handler)
server.serve_forever()


Browser running ftp:127.0.0.1:21

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325013173&siteId=291194637