Command-Line FTP Function Not Working – Troubleshooting

command lineftpwindows 7

I am using Windows 7 and have multiple FTP client applications working without any problem. However, when I use command-line FTP, I can get connected, log in (after entering user name and password), but it always gets disconnected when the dir or ls command is used. The response is:

Connection closed by remote host.

How can I fix this problem?

Best Answer

You'll usually see this type of thing happen when the server tries to connect back to you but can't. FTP originally used two TCP channels. One was for commands, and the other for transferring data. When you run the dir command it uses a data channel. The data channel is established on demand and results in the server trying to connect back to you.

That's most likely being blocked by your router or Windows firewall. You need a client that supports PASV mode.

You can enable PASV mode in Internet Explorer. Or use a different client. I'm not sure if the command-line version can use PASV mode. It's a very basic client.

Related Question