Package paramiko :: Class SFTPServer
[show private | hide private]
[frames | no frames]

Type SFTPServer

object --+            
         |            
  _Verbose --+        
             |        
        Thread --+    
                 |    
  SubsystemHandler --+
                     |
        object --+   |
                 |   |
          BaseSFTP --+
                     |
                    SFTPServer


Server-side SFTP subsystem support. Since this is a SubsystemHandler, it can be (and is meant to be) set as the handler for "sftp" requests. Use Transport.set_subsystem_handler to activate this class.
Method Summary
  __init__(self, channel, name, server, sftp_si, *largs, **kwargs)
The constructor for SFTPServer is meant to be called from within the Transport as a subsystem handler.
int convert_errno(e)
Convert an errno value (as from an OSError or IOError) into a standard SFTP result code. (Static method)
  finish_subsystem(self)
Perform any cleanup at the end of a subsystem.
  set_file_attr(filename, attr)
Change a file's attributes on the local filesystem. (Static method)
  start_subsystem(self, name, transport, channel)
Process an ssh subsystem in server mode.
    Inherited from SubsystemHandler
ServerInterface get_server(self)
Return the ServerInterface object associated with this channel and subsystem.
    Inherited from Thread
  __repr__(self)
  getName(self)
  isAlive(self)
  isDaemon(self)
  join(self, timeout)
  run(self)
  setDaemon(self, daemonic)
  setName(self, name)
  start(self)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Instance Method Details

__init__(self, channel, name, server, sftp_si=<class 'paramiko.SFTPServerInterface'>, *largs, **kwargs)
(Constructor)

The constructor for SFTPServer is meant to be called from within the Transport as a subsystem handler. server and any additional parameters or keyword parameters are passed from the original call to Transport.set_subsystem_handler.
Parameters:
channel - channel passed from the Transport.
           (type=Channel)
name - name of the requested subsystem.
           (type=str)
server - the server object associated with this channel and subsystem
           (type=ServerInterface)
sftp_si - a subclass of SFTPServerInterface to use for handling individual requests.
           (type=class)
Overrides:
paramiko.BaseSFTP.__init__

finish_subsystem(self)

Perform any cleanup at the end of a subsystem. The default implementation just closes the channel.
Overrides:
paramiko.SubsystemHandler.finish_subsystem (inherited documentation)

Since: 1.1

start_subsystem(self, name, transport, channel)

Process an ssh subsystem in server mode. This method is called on a new object (and in a new thread) for each subsystem request. It is assumed that all subsystem logic will take place here, and when the subsystem is finished, this method will return. After this method returns, the channel is closed.

The combination of transport and channel are unique; this handler corresponds to exactly one Channel on one Transport.
Parameters:
name - name of the requested subsystem.
           (type=str)
transport - the server-mode Transport.
           (type=Transport)
channel - the channel associated with this subsystem request.
           (type=Channel)
Overrides:
paramiko.SubsystemHandler.start_subsystem (inherited documentation)

Note: It is the responsibility of this method to exit if the underlying Transport is closed. This can be done by checking Transport.is_active or noticing an EOF on the Channel. If this method loops forever without checking for this case, your python interpreter may refuse to exit because this thread will still be running.


Static Method Details

convert_errno(e)

Convert an errno value (as from an OSError or IOError) into a standard SFTP result code. This is a convenience function for trapping exceptions in server code and returning an appropriate result.
Parameters:
e - an errno code, as from OSError.errno.
           (type=int)
Returns:
an SFTP error code like SFTP_NO_SUCH_FILE.
           (type=int)

set_file_attr(filename, attr)

Change a file's attributes on the local filesystem. The contents of attr are used to change the permissions, owner, group ownership, and/or modification & access time of the file, depending on which attributes are present in attr.

This is meant to be a handy helper function for translating SFTP file requests into local file operations.
Parameters:
filename - name of the file to alter (should usually be an absolute path).
           (type=str)
attr - attributes to change.
           (type=SFTPAttributes)

Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005 http://epydoc.sf.net