fs.sftpfs

Currently only avaiable on Python2 due to paramiko not being available for Python3

Filesystem accessing an SFTP server (via paramiko)

class fs.sftpfs.SFTPFS(connection, root_path='/', encoding=None, hostkey=None, username='', password=None, pkey=None, agent_auth=True, no_auth=False, look_for_keys=True)

A filesystem stored on a remote SFTP server.

This is basically a compatibility wrapper for the excellent SFTPClient class in the paramiko module.

SFTPFS constructor.

The only required argument is ‘connection’, which must be something from which we can construct a paramiko.SFTPClient object. Possible values include:

  • a hostname string
  • a (hostname,port) tuple
  • a paramiko.Transport instance
  • a paramiko.Channel instance in “sftp” mode

The keyword argument ‘root_path’ specifies the root directory on the remote machine - access to files outside this root will be prevented.

Parameters:
  • connection – a connection string
  • root_path – The root path to open
  • encoding – String encoding of paths (defaults to UTF-8)
  • hostkey – the host key expected from the server or None if you don’t require server validation
  • username – Name of SFTP user
  • password – Password for SFTP user
  • pkey – Public key
  • agent_auth – attempt to authorize with the user’s public keys
  • no_auth – attempt to log in without any kind of authorization
  • look_for_keys – Look for keys in the same locations as ssh, if other authentication is not succesful
close(*args, **kwargs)

Close the connection to the remote server.