rely:
pip3 install pyftpdlib
script:
Coding #: UTF- . 8 Import OS from pyftpdlib.authorizers Import DummyAuthorizer from pyftpdlib.handlers Import FTPHandler from pyftpdlib.servers Import FTPServer DEF main (): # instantiation user authorization management the Authorizer = DummyAuthorizer () authorizer.add_user ( ' User ' , ' 123456 ' , ' / ' , Perm = ' elradfmwMT ' ) # Add user parameters: username, password, allowing path permission authorizer.add_anonymous (os.getcwd ()) # anonymous users are allowed here, specify the path ru: '/ Hone / Hello' # instantiated FTPHandle Handler =FTPHandler handler.authorizer = the Authorizer # slogans when setting a client link handler.banner = 'How are you? I have noticed you a long time! Welcome to MyFTP . ' # Handler.masquerade_address = ' 192.168.88.2 ' # address = ( ' 192.168.88.2 ' , 21 ) #FTP generally use port 21, 20 Server = FTPServer (( ' 127.0.0.1 ' , 2121 ), Handler ) #FTP server instance # set a limit connected server.max_cons = 256 server.max_cons_per_ip= 5 # open server server.serve_forever () IF the __name__ == ' __main__ ' : main ()
Other portions of the configuration:
Coding #: UTF- . 8 #import OS from pyftpdlib.authorizers Import DummyAuthorizer from pyftpdlib.handlers Import FTPHandler, ThrottledDTPHandler from pyftpdlib.servers Import FTPServer from the conf Import Settings Import the logging DEF main) (: # instantiation user authorization management the Authorizer = DummyAuthorizer ( ) authorizer.add_user ( ' user ' , ' 123456 ' , ' / ' , Perm = ' elradfmwMT ' ) # Add user parameters: username, password, allowing the path, permissions # authorizer.add_anonymous (The os.getcwd ()) where # is the anonymous users are allowed to specify a path ru:' / Hone / Hello ' authorizer.add_anonymous ( ' / Home / Sea ' ) # upload speed download provided #dtp_handler = ThrottledDTPHandler # download speed, 300KB / S # dtp_handler.read_limit = 300 * 1024 # dtp_handler.write_limit = 300 * 1024 # Example of FTPHandle Handler = FTPHandler handler.authorizer = the Authorizer # handler.masquerade_address = ' # address192.168.88.2 ' # up IP number= ( ' 192.168.88.2 ' , 21 is ) #FTP ports 21, 20 is generally used #FTP server instance 0.0 . 0.0 Server = FTPServer (( ' 127.0.0.1 ' , 2121 ), Handler) # passive add port range handler.passive_ports = Range ( 2000 , 2333 ) # log # logging.basicConfig (filename = " /tmp/myftp/log.log " , Level = logging.info) # set a limit connected server.max_cons = 200 is = server.max_cons_per_ip . 5 # open server server.serve_forever () IF the __name__ == ' __main__ ' : main ()
About permissions, users can refer to: https://blog.csdn.net/hanyuyang19940104/article/details/80420500