3

I installed FileZilla ftp server on one of local server in local network. I can successfully list folders for user user using ftp command (actually I installed Ubuntu in windows 10 through Microsoft store).

ftp -p 192.168.11.24 21
Connected to 192.168.11.24.
220-FileZilla Server 0.9.60 beta
220-written by Tim Kosse (tim.kosse@filezilla-project.org)
220 Please visit https://filezilla-project.org/
Name (192.168.11.24:ms): user
331 Password required for user
Password:
230 Logged on
Remote system type is UNIX.
ftp> nlist /
227 Entering Passive Mode (192,168,11,24,203,217)
150 Opening data channel for directory listing of "/"
/crm-offers-browse-2018-03-08.xlsx
/log_file.txt
/model.png
226 Successfully transferred "/"

If I try the same with telnet (I sniffed the commands using Wireshark) command nlist does not work. It returns 425 Can't open data connection. What am I missing here?

enter image description here

telnet -e _ 192.168.11.24 21
Telnet escape character is '_'.
Trying 192.168.11.24...
Connected to 192.168.11.24.
Escape character is '_'.
220-FileZilla Server 0.9.60 beta
220-written by Tim Kosse (tim.kosse@filezilla-project.org)
220 Please visit https://filezilla-project.org/
USER user
331 Password required for user
PASS user
230 Logged on
SYST
215 UNIX emulated by FileZilla
PASV
227 Entering Passive Mode (192,168,11,24,205,245)
NLST /
425 Can't open data connection for transfer of "/"
broadband
  • 3,266
  • 6
  • 43
  • 73
  • 1
    After PASV command open another telnet connection (data channel) to adress/port returned from PASV (here 192.168.11.24 52725, the last two numbers are higher and lower byte of port number). Then when you trigger NLST in command channel (first telnet connection) the list will be returned through data channel. – Michal Butterweck Jun 14 '21 at 15:43
  • @MichalButterweck: I'm surprised your comment is not an answer as it's accurate and resolves the question of how to list FTP directories. For other Googlers, the structure is `PORT (h1,h2,h3,h4,p1,p2)` where the port number is found by `(p1 * 256) + p2`. This is what @Michal said if you already know about higher and lower bytes. – joshfindit Mar 31 '22 at 15:58

1 Answers1

0

The answer is described in this post: Telnet and passive FTP.

You cannot retrieve files over FTP protocol using a Telnet client.

While you can simulate the FTP client by typing FTP commands on a Telnet console, you cannot do file transfers this way. It's because for file transfer you need a separate data transfer connection, what the Telnet client cannot do.

That's why the FTP server fails. In an active mode, it fails to connect back to your client machine, because there's nothing listening. In a passive more, it timeouts waiting for the client to connect to its data port.

Community
  • 1
  • 1
broadband
  • 3,266
  • 6
  • 43
  • 73