Solved

Connection Time Out - LINUX

Posted on 2011-03-11
15
699 Views
Last Modified: 2012-05-11
While trying to FTP to a server, I am getting an error "Couldnot connect to the Server". I am using a 3rd party FTP Client - FileZilla.

Status:      Connecting to XXX.XXX.XXX.164:21...
Status:      Connection established, waiting for welcome message...
Response:      220 Access to this Computer System is Strictly Regulated and Subject to Criminal Prosecution
Command:      USER muser
Response:      331 Please specify the password.
Command:      PASS *********
Error:      Connection timed out
Error:      Could not connect to server
0
Comment
Question by:mnis2008
  • 6
  • 5
  • 2
  • +2
15 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 35111006
if you have a firewall then check if both ports 20 & 21 are allowed
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35111036
telnet XXX.XXX.XXX.164 21
0
 
LVL 7

Expert Comment

by:jackiechen858
ID: 35111359
from the message, you are already connected to port 21.  Seems a bit weird, It haven't even reach the data port connection, didn't show you are login. Are you sure you have the correct username/password?

Can you do a manually test, start a command line window, then  run "ftp XXX.XXX.XXX.164" , see if you can login first.

If you can login, but can't do "ls" to list remote directory, that means there is a firewall to block ftp data port. Ftp require two TCP connections: one command connection on port 21, one data connection, it could be from remote server to your machine's port 20 for active ftp, or from your machine to a remote port for passive ftp.

You can read this document:

http://slacksite.com/other/ftp.html

0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

Author Comment

by:mnis2008
ID: 35112700
As you suggested I am now connected to the server and I have both the ports open.

I am able to run all commands except "ls" I have attached the sequence of events, what should I enable to turn this on.


Connected to XXX.XXX.XXX.164.
220 Access to this Computer System is Strictly Regulated and Subject to Criminal
 Prosecution
User (XXX.XXX.XXX.164:(none)): muser
331 Please specify the password.
Password:
230 Login successful.
ftp> ls
500 Illegal PORT command.
> ftp: bind :Unknown error number
ftp> mkdir temp
257 "/temp" created
ftp> cd /temp
250 Directory successfully changed.
ftp> ls
> ftp: bind :Unknown error number
ftp>

Open in new window

0
 
LVL 3

Expert Comment

by:Alberto Cortes
ID: 35112836
Solution:

After you see: "230 Login successful" run next FTP command:
    PASV
This will request the server to give you the port to establish the data connection, and ruled out your firewall.
0
 

Author Comment

by:mnis2008
ID: 35112982
I am still getting the error. As suggested by Jackiechen858 I was able to open a commad line prompt and connect to my server but If I use an FTP client I get the error

Status:      Connecting to XXX.XXX.XXX.164:21...
Status:      Connection established, waiting for welcome message...
Response:      220 Access to this Computer System is Strictly Regulated and Subject to Criminal Prosecution
Command:      USER muser
Response:      331 Please specify the password.
Command:      PASS *********
Error:      Connection timed out
Error:      Could not connect to server
0
 

Author Comment

by:mnis2008
ID: 35112992
PASV run unsuccesful   < I am not using an FTP client > I am running this from MSDOS command line

331 Please specify the password.
Password:
230 Login successful.
ftp> PASV
Invalid command.
ftp> pasv
Invalid command.
ftp> ls
500 Illegal PORT command.
ftp: bind :Unknown error number
ftp> PASV
Invalid command.
ftp>
0
 
LVL 7

Expert Comment

by:jackiechen858
ID: 35113253
in ms ftp commandline, it's passive instead of pasv. But it wont really create passive connection so it's useless.  Now it's confirmed you can login, you can configure filezilla to use passive mode, see if it work.  
0
 

Author Comment

by:mnis2008
ID: 35113265
jackiechen858 --> Is there any setting on my server that will help me set the connection to passive
0
 
LVL 3

Expert Comment

by:Alberto Cortes
ID: 35113942
ftp> literal pasv
0
 

Author Comment

by:mnis2008
ID: 35114086
I am using an external FTP Client like FileZilla, The setting "literal pasv" is only valid when I connect using a terminal. So I still have the issue of connection time out

Status:      Connecting to XXX.XXX.XXX.164:21...
Status:      Connection established, waiting for welcome message...
Response:      220 Access to this Computer System is Strictly Regulated and Subject to Criminal Prosecution
Command:      USER muser
Response:      331 Please specify the password.
Command:      PASS *********
Error:      Connection timed out
Error:      Could not connect to server
0
 
LVL 7

Accepted Solution

by:
jackiechen858 earned 500 total points
ID: 35114088
Sorry I remeber it wrong, it's "literal pasv", but it doesn't really do passive ftp .

check:
http://blogs.isaserver.org/pouseele/2006/11/09/about-the-microsoft-command-line-ftp-client/

The ftp server need to support passive ftp, but most ftp server do support it. Then it's up to the client to decide passive or active. Filezilla does support passive mode.

for the server side, if it's a linux server with iptable firewall, you need to modify the ftp server configration to dedicate serveral (10~100, depend on how many people use your ftp server) port for passive ftp, then open firewall to allow incoming tcp connection for those port.



What's your ftp server?

0
 
LVL 7

Expert Comment

by:jackiechen858
ID: 35114092
seems you have some problem with your filezilla client, it doesn't even show you are connected. Can you try another ftp client?
0
 
LVL 7

Expert Comment

by:jackiechen858
ID: 35114096
0
 

Author Comment

by:mnis2008
ID: 35114313
Yes Now I am able to connect, I used a smartFTP in passive mode. Thanks a lot for your assistance jackiechen
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question