Solved

Connection Time Out - LINUX

Posted on 2011-03-11
15
703 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

738 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