Solved

Connection Time Out - LINUX

Posted on 2011-03-11
15
695 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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 navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

856 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