3
votes

I have a script which runs at server as cron job to download files using ncftpget. It fails.

I tried to investigate and found that the following command does not work :

ncftpget -v -E ftp://ftp.anexample.org/d1/d2/list

It says (very similar to):

ncftp : Server said : Cannot connect to port XXXX : Connection timed out.

Since active mode did not work, I tried PASV mode with -F option and that failed straight away. So neither active nor passive mode is working for the ftp site. While for other ftp sites things are working smoothly. Please let me know what could be the reason and what could be done to resolve it.

3
Try downloading and installing another FTP client, such as FileZilla and using the Graphical User Interface to hold your hand while connecting, and see if you get the same error. Sounds like network connectivity problems. - Eric Leschinski
Thanks Eric! But I have to use ncftp only for some official reasons. As I said, ncftpget is working fine for other ftp sites. Issue is just for a particular site. Have got some hints that it may have something to do with firewall. Any idea? - Ptk

3 Answers

2
votes

The command should be ncftpget -v -E ftp.anexample.org/d1/d2/list

0
votes

Are you able to make a manual connection with the ncftp client itself (instead of the automated ncftpget)? Have you checked the obvious - like ensuring that ftp.anexample.org is online, AND that you can connect to the appropriate TCP port? (Try "telnet ftp.anexmple.org 21")?

It smells like a firewall issue - perhaps the remote server admin needs to configure their firewall accept a connection from your IP address? It's not all that unusual for a provider - especially one who is exchanging proprietary information through FTP - to tighten down their firewall/server to only allow connections from a particular server.

So, before you try to automate, go through the manual steps to ensure that the connectivity is there.

0
votes

I know this post is old, but I found it when Googling, so I'm going to add my comment. I had a similar problem, and it's clearly related to my own firewall. Turning it off and trying the command fixed it. Now I just need to find a better solution.

Interesting read: https://www.ncftp.com/ncftpd/doc/misc/ftp_and_firewalls.html