Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Connection Time Out - LINUX

Posted on 2011-03-11
15
Medium Priority
?
731 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 2000 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

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…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

886 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