LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-17-2004, 06:56 AM   #1
redneon
Member
 
Registered: Aug 2003
Posts: 103

Rep: Reputation: 15
FTP Client via Telnet


I'm trying to write a simple frontend to an FTP site that I use. Not an fully fledged client. To do this I've captured a standard FTP stream using Ethereal which looks like this (the lines in red are the lines sent from my machine and the lines in black are the lines from the server)...

Code:
220 FTP server () ready.
USER user
331 Password required for user.
PASS password
230 User user logged in.
PORT 82,76,233,125,12,125
200 PORT command successful.
NLST
150 ASCII data connection for /bin/ls (82.76.233.125,3197) (0 bytes).
226 ASCII Transfer complete.
QUIT
221 Goodbye.
If I try to replicate this telnet to the server on port 21 when I run the NLST command it doesn't actually output a list. How can I get this output? It just seems to hang when I run NLST. Not even QUIT works afterwards. I've read through the RFC but I can't find anything useful.

Cheers,

Darrell
 
Old 10-17-2004, 07:29 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Ftp sessions actually consist of 2 connections, one for data and one for commands. You need to use PASV ftp if you want to connect to the server to receive the data rather than have the server connect to you.
 
Old 10-17-2004, 11:04 AM   #3
redneon
Member
 
Registered: Aug 2003
Posts: 103

Original Poster
Rep: Reputation: 15
So if I wanted to telnet to an FTP server what would I do? I've just tried opening two telnet connections to an FTP server and done this...

telnet 1
USER user
PASS pass

telnet 2
USER user
PASS pass
PASV

telnet 1
NLS

I thought this may display the result from the NLS on telnet 2 using the PASV mode you mentioned.

Darrell
 
Old 10-17-2004, 11:07 AM   #4
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
This should be everything you need regarding FTP sessions:

http://war.jgaa.com/ftp/?cmd=rfc
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Telnet Client? jonwatson Linux - Software 23 03-16-2009 04:31 AM
Best Telnet Client? Haggis Linux - Newbie 1 12-29-2004 01:05 PM
What telnet client? rivethead Linux - Software 3 03-25-2004 02:10 PM
What telnet client ? rivethead Linux - Software 5 02-27-2003 12:33 PM
ipchains, ftp from client to non-ftp ports atari303 Linux - Networking 2 11-08-2002 02:43 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration