Wildcard support was removed from the giampaolo/pyftpdlib library. Globbing functionality was available until r358. We could go back to r357 to see what was removed and reimplement it. https://github.com/giampaolo/pyftpdlib/issues/106#issuecomment-44425620
Globbing of wildcards is not supported (for example, NLST *.txt
will not work). ” - From the compliance doc https://github.com/giampaolo/pyftpdlib/blob/64d629aa480be4340cbab4ced1213211b4eee8db/docs/rfc-compliance.rst
Furthermore, he suggests using MLSD over NLST as a possible solution. https://github.com/giampaolo/pyftpdlib/issues/106#issuecomment-44425620 . My guess is that with modifications to the library the wildcard functionality can be restored.
Does anyone have any clue how to achieve this?
ADDITIONAL DETAILS:
We followed this tutorial and created an FTP server on Ubuntu 14.04 using the awesome pyftpdlib Python library. It was easy to setup the server, add users, and create hooks.
Some clients communicate with our FTP server directly from their server using mget. The mget command works if you specify the filename directly, but passing a wildcard fails. Here is a sample response:
ftp> dir
229 Entering extended passive mode (|||26607|).
125 Data connection already open. Transfer starting.
-rw-r--r-- 1 serverpilot serverpilot 914 Oct 06 19:05 index.php
226 Transfer complete.
ftp> mget *.php
No such file or directory.
ftp> glob
Globbing off.
ftp> mget *.php
mget *.php [anpqy?]? y
229 Entering extended passive mode (|||60975|).
550 No such file or directory.
ftp> mget index.php
mget index.php [anpqy?]? y
229 Entering extended passive mode (|||17945|).
125 Data connection already open. Transfer starting.
100% |***************************************************************************************************************************************************************| 914 763.53 KiB/s 00:00 ETA
226 Transfer complete.
914 bytes received in 00:00 (692.99 KiB/s)
Our script looks like this:
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
# The port the FTP server will listen on.
# This must be greater than 1023 unless you run this script as root.
FTP_PORT = 2121
# The name of the FTP user that can log in.
FTP_USER = "myuser"
# The FTP user's password.
FTP_PASSWORD = "change_this_password"
# The directory the FTP user will have full read/write access to.
FTP_DIRECTORY = "/srv/users/serverpilot/apps/APPNAME/public/"
def main():
authorizer = DummyAuthorizer()
# Define a new user having full r/w permissions.
authorizer.add_user(FTP_USER, FTP_PASSWORD, FTP_DIRECTORY, perm='elradfmw')
handler = FTPHandler
handler.authorizer = authorizer
# Define a customized banner (string returned when client connects)
handler.banner = "pyftpdlib based ftpd ready."
# Optionally specify range of ports to use for passive connections.
#handler.passive_ports = range(60000, 65535)
address = ('', FTP_PORT)
server = FTPServer(address, handler)
server.max_cons = 256
server.max_cons_per_ip = 5
server.serve_forever()
if __name__ == '__main__':
main()
It looks like wildcards were intentionally left out of the library based upon this issue. For reference, here is my own issue as well.
Can anyone provide more insight or guide me to reenabling wildcards?