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.X2GoRevFwTunnelToSFTP(server_port, ssh_transport, auth_key=None, session_instance=None, logger=None, loglevel=56)[source]¶ Bases:
x2go.rforward.X2GoRevFwTunnelA 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.X2GoRevFwTunnelToSFTPhas been started with itsstart()method. UseX2GoRevFwTunnelToSFTP.stop_thread()to stop the reverse forwarding tunnel again (refer also to its pause() and resume() method).X2GoRevFwTunnelToSFTP.run()waits for notifications of an appropriate incoming Paramiko/SSH channel (issued byX2GoRevFwTunnelToSFTP.notify()). Appropriate in this context means, that its starting point on the X2Go server matches the class’s propertyserver_port.Once a new incoming channel gets announced by the
notify()method, a newx2go.sftpserver.X2GoRevFwSFTPChannelThreadinstance will be initialized. As a data stream handler, the functionx2go_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
X2GoRevFwTunnelToSFTP.pause()call or stopped via theX2GoRevFwTunnelToSFTP.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.X2GoRevFwTunnelToSFTPinstance.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.X2GoRevFwTunnelToSFTPparent thread gets paused. The call ofX2GoRevFwTunnelToSFTP.pause()on the instance can be used to shut down all incoming tunneled SSH connections associated to thisx2go.sftpserver.X2GoRevFwTunnelToSFTPinstance from within a Python X2Go application.
Parameters: - chan (paramiko.Channel instance) – an incoming sFTP channel (Default value = None)
- auth_key (
paramiko.RSAKeyinstance) – Paramiko/SSH RSAkey object that has to be authenticated against by the remote sFTP client (Default value = None) - logger (
X2GoLoggerinstance) – you must pass anx2go.log.X2GoLoggerobject to this handler method (Default value = None)