For no good reason, I've been trying to implement a basic FTP server w/ Twisted 2.2. After a few puzzling exceptions, some custom code, TOSSING the custom code, and more quality time with the source, I've come to the conclusion that I need a nudge in the right direction.
Initially, it looks like it should be pretty straightforward (as much as it ever gets in Twisted anyway :), but it's not working. Here's the code:
===============
from twisted.protocols.ftp
import FTPFactory
from twisted.protocols.ftp import FTPRealm
from twisted.cred.portal import Portal
print "Starting FTP server"
p = Portal(FTPRealm('./')) # start up in local dir for giggles
f = FTPFactory(p)
from twisted.internet import reactor
reactor.listenTCP(21, f)
reactor.run()
print "FTP Server terminated."
===============
Simple. This raises no exceptions, and appears to be working until I actually log in.
===============
ftp> open localhost
Connected to elric.
220 Twisted 2.2.0 FTP Server
User (elric:(none)): anonymous
331 Guest login ok, type your email address as password.
Password:
530 Sorry, Authentication failed.
Login failed.
===============
The shell it's running from shows no errors or exceptions. So why did my anonymous login fail?
(I'll wait until I solve that before I tackle the issue of actual "real" users)
--
"Ladies and gentlemen, there's nothing to worry about ... but please keep your heads down."
Best,
Jeff