tags:

views:

34

answers:

2

I'm trying to connect to an FTP server which allows anonymous access, I don't know how to specify the appropriate username/password required to do this though.

I've tried using anonymous/anonymous as the user/pass with no luck, as well the empty string and various combinations of the two, etc.

It's gotta be something simple that I'm missing, I can use connect just fine with curl ftp://server/

Using python:

stu@sente ~ $ cat - | python
import ftplib
ftp = ftplib.FTP("ftp.server")
ftp.set_debuglevel(2)
ftp.connect()
ftp.login()
list = ftp.nlst()
ftp.close()
print "\n", " ".join(list)
^D

*get* '220 ftp.server NcFTPd Server (licensed copy) ready.\r\n'
*resp* '220 ftp.server NcFTPd Server (licensed copy) ready.'
*cmd* 'USER anonymous'
*put* 'USER anonymous\r\n'
*get* '331 Guest login ok, send your complete e-mail address as password.\r\n'
*resp* '331 Guest login ok, send your complete e-mail address as password.'
*cmd* 'PASS **********'
*put* 'PASS **********\r\n'
*get* '230 Logged in anonymously.\r\n'
*resp* '230 Logged in anonymously.'
*cmd* 'TYPE A'
*put* 'TYPE A\r\n'
*get* '200 Type okay.\r\n'
*resp* '200 Type okay.'
*cmd* 'PASV'
*put* 'PASV\r\n'
*get* '227 Entering Passive Mode (12,161,242,12,128,138)\r\n'
*resp* '227 Entering Passive Mode (12,161,242,12,128,138)'
*cmd* 'NLST'
*put* 'NLST\r\n'
*get* '150 Data connection accepted from 208.118.225.99:38451; transfer starting.\r\n'
*resp* '150 Data connection accepted from 208.118.225.99:38451; transfer starting.'
*get* '226 Listing completed.\r\n'
*resp* '226 Listing completed.'

Obin bin pub public sci_tech_med
A: 

haha, apparently I'm not very good at reading instructions, specifically when the server says things like 331 Guest login ok, send your complete e-mail address as password.

follow up question though, what username/password does curl/python use by default? and how can I inspect the raw data?

Stuart Powers
Why don't you ask this as a separate question instead of as an answer to another question?
BryanH
+1  A: 

Anonymous ftp logins are usually the username 'anonymous' with the user's email address as the password. Some servers parse the password to ensure it looks like an email address.

User:  anonymous
Password:  [email protected]
Amardeep