[Twisted-Python] ssh client and server

cyli at alum.mit.edu cyli at alum.mit.edu
Fri Apr 11 11:50:29 EDT 2008

If I understand you correctly, you want a shelless SSH server but one 
that executes commands.  For instance, it will accept the following 

ssh server "echo Hello!"

But not:

ssh server

Is this correct?  I'm did something similar, except that I also reject 
the first type of command.  What I did was to overwrite 
session.SSHSession's request_shell command to terminate the connection 
instead of returning a shell.    And then of course I subclassed 
ConchUser to return my own session (rather than session.SSHSession) for 
the channelLookup, and wrote my own realm that returned my user from 

There may be a better way to do it, but this is short, and it works. I 
stuck my code up here in case you want to look at it: 

On 03:08 pm, vvangelovski at gmail.com wrote:
>I did look at that too. In and Ideal situation I'd make a server that 
>responds to exec from the client, generates a response for the command 
>and sends it back to the client, then drops the connection. But I can't 
>find a way to do that.
>Kuba Konczyk wrote:
>>Have a look at 
>>2008/4/11, Vasil Vangelovski <vvangelovski at gmail.com>:
>>>I want to write a custom ssh server and client. the client should
>>>  authenticate, execute just one command on the server and get back 
>>>  response. I've been following the examples from the O'reilly book, 
>>>  I'm kinda lost. Basicaly what I wand to do is use the client from 
>>>  last example, but a simpler server without a terminal emulator,
>>>  nothing fancy. Can anyone help?
>>Twisted-Python mailing list
>>Twisted-Python at twistedmatrix.com
>Twisted-Python mailing list
>Twisted-Python at twistedmatrix.com

More information about the Twisted-Python mailing list