<font style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt">I got just what I needed with a custom TerminalRealm sending the avatarId and TerminalUser to a custom TerminalSession, grabbing client host, port, sessionno and terminal at openShell(); then put in some cleanup on closed().<br><br>Thanks for pointing me right where I needed to go!<br><br>------------------------------<br><br>On Sat, 4 Jul 2009 02:11:36 -0700, asset  wrote:<br>&gt;Ive been at it for several days now trying to get at the username<br>&gt;(avatarId), session id (SSHChannel session # I imagine), and terminal<br>&gt;protocol instance (recvline.HistoricRecvLine) of my application's SSH<br>&gt;terminal service's clients.  Specifically, I'm trying to expose these three<br>&gt;things (for all connected users) to my terminal commands which are using<br>&gt;the plugin system.<br>&gt;<br>&gt;I'm not considerably far off from this example for the setup,<br>&gt;<a target="_blank" href="http://twistedmatrix.com/projects/conch/documentation/examples/demo_recvline">http://twistedmatrix.com/projects/conch/documentation/examples/demo_recvline</a><br>&gt;.tac, minus the telnet support.<br>&gt;<br>&gt;For the life of me I can't seem to determine how best to approach this.<br>&gt;Ive come as far as getting a list of the terminal recvline.HistoricRecvLine<br>&gt;instances and then being able to manipulate the client terminals directly,<br>&gt;but I need the usernames from the avatars and session id as well.<br>&gt;<br>&gt;I imagine this is a pretty common and simple thing, so I'm hoping that<br>&gt;somebody can point me in the right direction.  Please help if you can.<br><br>The realm's requestAvatar is passed the avatarId:<br><br><a target="_blank" href="http://twistedmatrix.com/trac/browser/trunk/twisted/conch/manhole_ssh.py#L82">http://twistedmatrix.com/trac/browser/trunk/twisted/conch/manhole_ssh.py#L82</a><br><br>See how this realm (which I assume is the one you're using, since it is the<br>one used by demo_recvline) passes the avatarId to its `userFactory?, but the<br>`TerminalUser? which is the default `userFactory? ignores it.<br><br>It seems like you want to provide an alternate `userFactory? which saves the<br>avatarId passed to it.<br><br>For the session id, perhaps this information you can find on the connection<br>object.  See the API documentation:<br><br><a target="_blank" href="http://twistedmatrix.com/documents/current/api/twisted.conch.ssh.connection.SSHConnection.html">http://twistedmatrix.com/documents/current/api/twisted.conch.ssh.connection.SSHConnection.html</a><br><br>Jean-Paul<br><br></font>