x2go.sftpserver module

For sharing local folders via sFTP/sshfs Python X2Go implements its own sFTP server (as end point of reverse forwarding tunnel requests). Thus, Python X2Go does not need a locally installed SSH daemon on the client side machine.

The Python X2Go sFTP server code was originally written by Richard Murri, for further information see his website: http://www.richardmurri.com

class x2go.sftpserver.X2GoRevFwSFTPChannelThread(channel, remote=None, **kwargs)[source]

Bases: x2go.rforward.X2GoRevFwChannelThread

class x2go.sftpserver.X2GoRevFwTunnelToSFTP(server_port, ssh_transport, auth_key=None, session_instance=None, logger=None, loglevel=56)[source]

Bases: x2go.rforward.X2GoRevFwTunnel

A reverse fowarding tunnel with an sFTP server at its endpoint. This blend of a Paramiko/SSH reverse forwarding tunnel is used to provide access to local X2Go client folders from within the the remote X2Go server session.

run()[source]

This method gets run once an x2go.sftpserver.X2GoRevFwTunnelToSFTP has been started with its L{start()} method. Use x2go.sftpserver.X2GoRevFwTunnelToSFTP.stop_thread() to stop the reverse forwarding tunnel again (refer also to its pause() and resume() method).

L{X2GoRevFwTunnelToSFTP.run()} waits for notifications of an appropriate incoming Paramiko/SSH channel (issued by L{X2GoRevFwTunnelToSFTP.notify()}). Appropriate in this context means, that its starting point on the X2Go server matches the class’s property server_port.

Once a new incoming channel gets announced by the L{notify()} method, a new x2go.sftpserver.X2GoRevFwSFTPChannelThread instance will be initialized. As a data stream handler, the function L{x2go_rev_forward_sftpchannel_handler()} will be used.

The channel will last till the connection gets dropped on the X2Go server side or until the tunnel gets paused by an L{X2GoRevFwTunnelToSFTP.pause()} call or stopped via the X2GoRevFwTunnelToSFTP.stop_thread() method.

x2go.sftpserver.x2go_rev_forward_sftpchannel_handler(chan=None, auth_key=None, logger=None)[source]

Handle incoming sFTP channels that got setup by an x2go.sftpserver.X2GoRevFwTunnelToSFTP instance.

The channel (and the corresponding connections) close either ...

  • ... if the connecting application closes the connection and thus, drops the sFTP channel, or
  • ... if the x2go.sftpserver.X2GoRevFwTunnelToSFTP parent thread gets paused. The call of L{X2GoRevFwTunnelToSFTP.pause()} on the instance can be used to shut down all incoming tunneled SSH connections associated to this x2go.sftpserver.X2GoRevFwTunnelToSFTP instance from within a Python X2Go application.
Parameters:
  • chan (paramiko.Channel instance) – an incoming sFTP channel (Default value = None)
  • auth_key (paramiko.RSAKey instance) – Paramiko/SSH RSAkey object that has to be authenticated against by the remote sFTP client (Default value = None)
  • logger (X2GoLogger instance) – you must pass an x2go.logger.X2GoLogger object to this handler method (Default value = None)