python build a key ftp service

from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
authorizer=DummyAuthorizer()
authorizer.add_user('xcsg','1234','.',perm='elradfmw')
handler=FTPHandler
handler.authorizer=authorizer
server=FTPServer(('192.168.2.222',21),handler)
server.serve_forever()

The code is simple, with pyftpdlib this module, import the module, instantiating, fifth line is the need for what he defined, according to the order as, account number, password, directory location, permissions, anyway own use, give the highest authority on the line, authority letter on behalf of the meaning of self-discovery can run after the eighth line is also a need to define their own computer ip address, and the port can be completed in the browser and enter ftp: // ip on it

Guess you like

Origin www.cnblogs.com/xcsg/p/11440151.html