Thursday, November 13, 2014

Ftp server with zero configuration

Log in to the server, pip install pyftpdlib and type in python interpreter
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
authorizer = DummyAuthorizer()
authorizer.add_user('test', 'test37', '/some/dir/')
handler = FTPHandler
handler.authorizer = authorizer
server = FTPServer(('0.0.0.0', 5021), handler)
server.serve_forever()
Try it out
~$ ftp
ftp> open X.X.X.X 5021
Connected to X.X.X.X.
220 pyftpdlib 1.4.0 ready.
Name (X.X.X.X:adolgarev): test
331 Username ok, send password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> passive
Passive mode on.
ftp> ls
227 Entering passive mode (X,X,X,X,X,X).
150 File status okay. About to open data connection.
-rw-r--r--   1 4001     4001      3622358 Aug 20 08:17 xxx
drwxr-xr-x   3 4001     4001         4096 Jul 09 10:57 xxx
-rw-r--r--   1 4000     4000      3585261 Jul 09 12:49 xxx
drwxr-xr-x   3 4000     4000         4096 Aug 20 08:35 xxx
226 Transfer complete.
Even more, it is surprisingly fast, see comparison to other implementations.

No comments:

Post a Comment