Search code examples
linuxftprhelproftpd

ProFTPd support for MLST and MLSD commands


Have another interesting problem. My company recently switched over to ProFTP to handle it's FTP and SFTP needs. We primarily run RHEL 5 servers. Our users are able to login, and transfer files without issue (for the most part anyway :-P).

Ran into a strange issue however with one of our clients, who need to list an individual file (in their FTP session) after performing a file transfer operation. They are able to list an entire directory just fine with 'ls', but when doing so with an exact file name (and/or with a wildcard), the listing fails.

I was able to duplicate the issue on my Windows workstation using ncftp, but NOT on my Linux workstation. After turning on debugging for both clients, as well as enabling full FTP command logging on the server-side, I discovered that the Linux FTP client uses a LIST command whereas ncftp uses an MSLD command.

Linux client:

ftp> debug

Debugging on (debug=1).

ftp> ls file.txt

ftp: setsockopt (ignored): Permission denied

---> PASV

227 Entering passive mode (X.X.X.X).

---> LIST file.txt
150 Opening ASCII mode data connection for file list

-rw-r--r--   1 0        root      9318400 Aug 28 07:29 file.txt
226 Transfer complete

ncftp (Windows) client:

ncftp / > debug

ncftp / > ls file.txt
> ls file.txt


Cmd: PASV

227: Entering passive mode (X.X.X.X).

Cmd: MLSD file.txt
550: 'file.txt is not a directory

List failed.

From what I've been able to gather so far, MLSD and MLST are the extended versions of the traditional FTP LIST command(s). But when listing an individual file, shouldn't the client be issuing the server a MLST command instead of a MLSD command? MLSD should be used to list entire directories from what I've read so far.

I also connected to our old FTP server (running VSFTP) with multiple clients in debug mode (including ncftp), and confirmed that they were ALL using the older LIST command for everything, and it worked perfectly. Whether this was because it was enforced on the server-side, or just by coincidence, I do not know.

I've also read that mod_facts needs to be enabled for MLSD/MLST to work. I've confirmed that my proftpd version supports it, and that it's enabled on the server:

[root@server ~]# proftpd -v

ProFTPD Version 1.3.5


From proftpd.conf:
# Adding support for extended FTP listing commands (e.g. MLST, MLSD, etc)

LoadModule mod_facts.c

<IfModule mod_facts.c>
        FactsAdvertise off
</IfModule>

I've also tried toggling FactsAdvertise of and off, reloading the service as I do so, and the ncftp client STILL wants to do an MLSD of the individual file!

So my two basic questions are:

  • How can I get proftpd to play nice with MLSD/MLST commands, and if that's too much hassle . .
  • How do I enforce FTP clients connecting to the ProFTP server to use the traditional LIST command(s), as was evidently the case with our old FTP service (VSFTP).

Thanks in advance!


Solution

  • My apologies, I forgot I had this still open. We found a fix for this on the ProFTP fourms:

    https://forums.proftpd.org/smf/index.php?topic=11604.0