tags:

views:

71

answers:

1

Hi, can anyone recommend a good example or tutorial of how to add SFTP capabilities to a Twisted Conch SSH server? Is it possible to run an Conch SFTP server that I can connect to using other SFTP clients? I'm just getting started with Twisted. Thanks.

A: 

Probably the best existing example of doing this is in the code in Twisted Conch itself for setting up a normal filesystem-backed SFTP server. You can find the basic code for hooking up the SFTP subsystem in twisted/conch/unix.py, in UnixConchUser.__init__. Then, if you look in twisted/conch/ssh/filetransfer.py to see what code is actually being hooked up to the avatar, you'll see that it expects the avatar to be adaptable to ISFTPServer. This adapter is used to satisfy all the actual SFTP protocol actions, like opening files. Then, jumping back to twisted/conch/unix.py, you can look at SFTPServerForUnixConchUser as an example implementation of ISFTPServer. Depending on how you want to handle SFTP requests, you may want to re-use this class or implement your own version.

Clearly none of this code was written primarily for the purpose of documentation, but it's the only example of using this SFTP code that I know of.

Jean-Paul Calderone