Advertisement
Guest User

Untitled

a guest
Sep 11th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. from pyftpdlib.authorizers import DummyAuthorizer
  2. from pyftpdlib.handlers import FTPHandler
  3. from pyftpdlib.servers import FTPServer
  4.  
  5.  
  6. # The port the FTP server will listen on.
  7. # This must be greater than 1023 unless you run this script as root.
  8. FTP_PORT = 21
  9.  
  10. # The name of the FTP user that can log in.
  11. FTP_USER = "xander"
  12.  
  13. # The FTP user's password.
  14. FTP_PASSWORD = "root"
  15.  
  16. # The directory the FTP user will have full read/write access to.
  17. FTP_DIRECTORY = "/tmp"
  18.  
  19.  
  20. def main():
  21. authorizer = DummyAuthorizer()
  22.  
  23. # Define a new user having full r/w permissions.
  24. authorizer.add_user(FTP_USER, FTP_PASSWORD, FTP_DIRECTORY, perm='elradfmw')
  25.  
  26. handler = FTPHandler
  27. handler.authorizer = authorizer
  28.  
  29. # Define a customized banner (string returned when client connects)
  30. handler.banner = "pyftpdlib based ftpd ready."
  31.  
  32. # Optionally specify range of ports to use for passive connections.
  33. #handler.passive_ports = range(60000, 65535)
  34.  
  35. address = ('', FTP_PORT)
  36. server = FTPServer(address, handler)
  37.  
  38. server.max_cons = 256
  39. server.max_cons_per_ip = 5
  40.  
  41. server.serve_forever()
  42.  
  43.  
  44. if __name__ == '__main__':
  45. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement