Solved

Connection Time Out - LINUX

Posted on 2011-03-11
15
685 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
Comment Utility
if you have a firewall then check if both ports 20 & 21 are allowed
0
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
telnet XXX.XXX.XXX.164 21
0
 
LVL 7

Expert Comment

by:jackiechen858
Comment Utility
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
 

Author Comment

by:mnis2008
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 7

Expert Comment

by:jackiechen858
Comment Utility
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
Comment Utility
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
Comment Utility
ftp> literal pasv
0
 

Author Comment

by:mnis2008
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
0
 

Author Comment

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

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
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 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.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now