python3实现FTP服务器服务的方法

程博学
2023-12-01

参考链接:https://www.jb51.net/article/110901.htm

一、安装模块 pyftpdlib

pip3 install pyftpdlib

二、本地验证

from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer

# 实例化DummyAuthorizer来创建ftp用户
authorizer = DummyAuthorizer()

# 参数:用户名,密码,目录,权限
authorizer.add_user('user', '12345', 'C:/Users/dqqh8/Desktop', perm='elradfmwMT')

# 匿名登录
# authorizer.add_anonymous('/home/nobody')

handler = FTPHandler
handler.authorizer = authorizer

#添加被动端口范围
handler.passive_ports = range(2000, 2333)

# 参数:IP,端口,handler
# server = FTPServer(('192.168.1.223', 2121), handler)   #外网
server = FTPServer(('10.104.131.83', 2121), handler)
server.serve_forever()

其他链接:

https://www.cnblogs.com/yili16438/p/d3209323913c6d53e6060fcd8d27e4c0.html

https://www.cnblogs.com/kaituorensheng/p/4480512.html

https://www.jb51.net/article/110901.htm

https://blog.csdn.net/qq_23948283/article/details/53573606?utm_source=blogxgwz1

https://www.cnblogs.com/botoo/p/8194671.html

https://www.example-code.com/python/ftp_filePermissions.asp

https://blog.csdn.net/qq_39091609/article/details/79338906

https://www.cnblogs.com/yili16438/p/d3209323913c6d53e6060fcd8d27e4c0.html

 

 类似资料: