Link to home
Start Free TrialLog in
Avatar of johnny_5
johnny_5

asked on

ftp uncertainties...

Hello...

Lately, for some god-only-knows reason, I've become obsessed with trying to telnet to an ftp port, login, and get LIST to work!  This, however, seems to be beyond my humble capabilites because everytime I try, the ftp daemon and I do a little dance that goes kinda' like this...

220 Server ready.
<user dude>
331 Password required for dude.
<pass duder>
230 User dude logged in.
<list> or <nlst> or whatever you like...
425 Can't build data connection: Connection refused.

Draaah!!!  Stupid thing!  Okay - I think I have a lead though, and that is this mystical PORT command - typing HELP PORT (the HELP command goes through nicely, even in my impotent state) gives me the OH-SO-HELPFUL...
PORT <sp> h1,h2,h3,h4,p1,p2

I figured out quickly enough that the h? quadruplets represent a dotted quad, and I just *know* that the last two are a 16-bit number describing my local port, BUT - I just read that in a file somewhere. ;)  No other clues here.  If I were stubborn, I'd keep cussing at the search engines to give me an RFC or a FAQ with some useful information.  And I am stubborn... :) But why waste time when you have experts-exchange, eh? SO - pardon the simple stupidity of this question, and as for the category, it's really a "networking in general" question - but there isn't that category.  And I figured unix networking is the purest form of TCP/IP.  So.  Any answers out there?

Avatar of elfie
elfie
Flag of Belgium image

As far as know what you are trying to do is impossble (unless you are trying to find some security holes in ftp).

Whenever you connect to an 'ftp port', the other site will redirect your request to the 'ftp'-daemon process. As i don't know the internals of both telnet and ftp, it seems quiet reasonable to me that don't understand the special command which only exists in one of both programs. You can login because that is some 'generally' shared code amongst these programs, but besides this they have not that must in common.
Avatar of johnny_5
johnny_5

ASKER

Well, what I mean when I say that I telnet to that port, I mean that I'm just using the telnet program as a tcp/ip interpreter to get me some kind of text response and so I can send some kind of text command.  I'm trying to put together an ftp client of sorts, and I keep having the same problems trying to interface to the ftp servers.  That's all - I know there's a way - I watch CuteFTP send the PORT command before every LIST, NLST, etc.  I just personally don't know what those last two numbers are...

Thanks though!

Just a guess, couldn't it be that they are checking to see if the correct kind of program is at the other site?

If in Unix we talk about ports, most of the times some kind of service is referred to. So check the matching of port numbers and services, you can verify (on unix) the /etc/services file.

just my $.02 (now)
ASKER CERTIFIED SOLUTION
Avatar of bertvermeerbergen
bertvermeerbergen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you!  That's EXACTLY what I wanted to know.  Okay - I got it now - I was thinking I would have to do something along those lines, but I wasn't sure specifically... What ended up happening was that I was putting the control connection (the first one) into passive mode and issuing the port command to it, but that wasn't quite working right.  What I needed was a second connection.  Just trying to write an FTP client from scratch is all, and I wanted to know if it was going to be worth it or not.

Thanks again!