Shelless SSH Server with Twisted

Apr 11, 2008 11:39

I needed a shelless SSH server that would not honor shell requests or exec commands, because I wanted to provide SFTP access without allowing shell access. I'm only posting this because this may be useful to people - I don't know Twisted very well, and there may be a better way to do it, but this works:

from zope import interface ( Read more... )

python, twisted

Leave a comment

Comments 2

where is the SFTP implementation ext_138641 December 17 2008, 20:07:17 UTC
(and where is the

if __name__ == '__main__':
....

I would love to try reusing this code but need more of this example.
Thanks

Reply


... anonymous December 23 2008, 11:11:38 UTC
Nice one, it kind of helped me.

Looks like you forgot about SSH tunneling. Here's how you allow it:

self.channelLookup['direct-tcpip'] = twisted.conch.ssh.forwarding.openConnectForwardingClient

Now set a function that raises an exception, and you are done (=> connection gets closed). I have not yet figured out how to send an error message to the client.

Tests would be nice.

Reply


Leave a comment

Up