Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP - sendcmd

Status
Not open for further replies.

eclecticNancy

Programmer
May 18, 2007
19
US
I'm not clear whether I have a problem with FTP/SSL or with Python (or perhaps both). I'm new to both.

When I do this...

import ftplib
c = ftplib.FTP()
c.set_debuglevel(2)
c.connect(ipaddress)
c.sendcmd('AUTH-SSL')

The response to the sendcmd is as follows:

*cmd* 'AUTH-SSL'
*put* 'AUTH-SSL\r\n'
*get* "500 'AUTH-SSL': command not understood.\r\n"
*resp* "500 'AUTH-SSL': command not understood."
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Program Files\Python23\lib\ftplib.py", line 241, in sendcmd
return self.getresp()
File "C:\Program Files\Python23\lib\ftplib.py", line 214, in getresp
raise error_perm, resp
error_perm: 500 'AUTH-SSL': command not understood



Am I misusing the sendcmd method? Or is this this more an FTP error to figure out?

Thank you,

Nancy
 
Do not know about the particular command but
your server replied that it does not know about the "AUTH-SSL" command.
You'll get the same result if you send "FooBar", "Justin", etc.

Perhaps try with "AUTH SSL" as in your previous thread.
 
Thanks Justin... I just caught that error this morning when I looked at it again.

Now I'm one small step forward to here...

<code>
>>> c.sendcmd('AUTH SSL')
*cmd* 'AUTH SSL'
*put* 'AUTH SSL\r\n'
*get* '334 SSLv23/TLSv1\r\n'
*resp* '334 SSLv23/TLSv1'
'334 SSLv23/TLSv1'
>>> c.sendcmd('USER prkhbrer')
*cmd* 'USER prkhbrer'
*put* 'USER prkhbrer\r\n'
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Program Files\Python23\lib\ftplib.py", line 241, in sendcmd
return self.getresp()
File "C:\Program Files\Python23\lib\ftplib.py", line 207, in getresp
resp = self.getmultiline()
File "C:\Program Files\Python23\lib\ftplib.py", line 193, in getmultiline
line = self.getline()
File "C:\Program Files\Python23\lib\ftplib.py", line 180, in getline
line = self.file.readline()
File "C:\PROGRA~1\PYTHON23\lib\socket.py", line 338, in readline
data = self._sock.recv(self._rbufsize)
error: (10054, 'Connection reset by peer')
</code>

What does this tell me?
 
Have you tried connecting using various FTP client?
e.g., WS_FTP, CoreFTP, Secure FTP.

If none of these clients can connect, I suggest you contact the FTP server admin or your network admins.

If any or all can connect then post back.
 
I don't have the client apps available on the machine I'm trying to connecting from. I do have CoreFTP connecting from a different machine, but do not have Py on that other one.

Does it look like it might be a firewall issue? Maybe they didn't open up for this server?

Thanks again for all your help,
Nancy
 
Sorry for the confusion.

Machine 1 (currently doing the ftp): connecting fine with 3rd party ftp client (CoreFTP). That machine does not have Python installed but maybe I could get that approved so I can test code there where I know connection works.

Machine 2 (better machine from which we want to do the ftp): does not have 3rd party ftp client. Am trying to implement ftp/ssl using Python so we can hopefully pull in the (many very large) files much faster than we are now.


Both machines are "supposed to" be allowed through the client's firewall. I attempted to contact them to double-check that Machine 2 is allowed in, but haven't heard back yet.

I'll see if I can get an ok to get Py on Machine 1, and will try again to contact the client about Machine 2's IP address.

Thanks again for your ongoing help with this.
 
grasping at straws here but can you try

import _ssl

at the interactive prompt and tell me what you get?

btw, what Python version and platform?
 
I got Py installed on the machine w/ CoreFTP running successfully. Still not getting through. I also heard back from our client who confirmed their firewall is open for both of our machines.

Am using Python 2.4 (pywin32 extensions build 204). "Machine 1" (where coreftp works) is running WinXP Pro.

Did notice something via the CoreFTP though... Windows SSL is selected rather than Open SSL - but I didn't see where in the log that's established in communication with the server. Is there an ftp command that establishes that? Or does it require something other than _ssl?

btw import _ssl does 'work'... no error messages when I typed that, just a prompt.

Here's a more complete list of the SSL options I saw on the CoreFTP screen...
AUTH SSL - on
AUTH TLS - off
SSL Direct - off
SSL Listings - on
SSL Transfers - on
OpenSSL - off
Windows SSL - on
PASV - on
HHS/SFTP - off
Use Proxy - off


I'm sending a command for AUTH SSL, and I can't make it up to the point where PASV is sent. I don't know how to "turn on?" Windows SSL though... is that where my problem might lie?
 
Another thought (after googling around a bit more... which has just ended with another unrelated 'fire alarm' issue)...

Am I bombing at the point where security certificates are exchanged? Is there something I should be setting/doing so that this exchange takes place? I happen to be looking at this...


I'm not familiar with nor am I using smartftp... just googling for anything that might shed light.
 
can you turn on verbose logging at CoreFTP then send me the connection logs?
flabio at gmail dot com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top