Implementation available for Python programming Write very efficient, scalable and asynchronous FTP servers with Python. > starting FTP server on 127.0.0.Python FTP server library provides a high-level portable interface to easily Using: user: user pass: 12345 port: 21 dir: /tmp/srvtest Server = FTPServer(("127.0.0.1", optargs.port), handler)Ĭall with: $ sudo python ftpserver-cli.py -directory=/tmp/srvtest #authorizer.add_anonymous("/home/nobody") Print("Using: user: %s pass: %s port: %d dir: %s" % (ername, optargs.password, optargs.port, optargs.directory))Īuthorizer.add_user(ername, optargs.password, optargs.directory, perm="elradfmw") Optargs = optparser.parse_args(sys.argv) #(sys.argv) Optparser.add_argument('-d', '-directory', action='store', type=str,ĭefault="/home/stefano/Projekte/", help="port") Optparser.add_argument('-t', '-port', action='store', type=int, Optparser.add_argument('-p', '-password', action='store', type=str, Optparser.add_argument('-u', '-username', action='store', type=str, Optparser = argparse.ArgumentParser(description="ftpserver-cli",įormatter_class=argparse.RawDescriptionHelpFormatter) ("/path/to/pyftpdlib-svn") # enter your proper path hereįrom thorizers import DummyAuthorizerįrom pyftpdlib.handlers import FTPHandler For the (2014) version of pyftpdlib, use this script ( ftpserver-cli.py) to achieve the same as above: #!/usr/bin/env python not setting a password or something like that.ĮDIT: since the API of pyftpdlib and ftpserver.py changed (and the ubuntu pastebin links are gone) most of the above post doesn't work anymore. It won't warn you, like the command line does, about using an insecure configuration. This should be simple, making the port configurable requires complex error handling which I don't want the user to bother with. I've not bothered with anything other than port 2121. You can still import it as a python module or use the above command line fu. make it executable and double click it, or create a launcher for it), it starts a little gui for you to configure your server. When it's started without any parameters (i.e. I'm sorry it's 3999 lines long, but it will do everything the original does. username=USERNAME and -password=PASSWORD: python ftpserver.py -port=2121 -username=ftpuser -password=3r2u389r2u333j You now have, in addition to all options I mentioned, the command line parameters Now, this script doesn't support username and password as part of it's stand-alone functionality (for security reasons I imagine). Read the license text, it's only a few lines, and know your rights. log into it at note that this software is released under the terms of the MIT License, which means you can do basically what ever you please with it. Type python ftpserver.py -help to get information about all the options. It will also use the directory FTP in the current working directory instead of your home. Will serve, without root privileges, on port 2121 and grant write access to anonymous users. This command: python -m pyftpdlib -directory=FTP -port=2121 -write This is meant more as a test of the module, but it does what it says on the tin. You now have an ftp server which you can log in to anonymously sharing your home directory.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |