Package paramiko :: Class SSHConfig
[frames | no frames]

Type SSHConfig

object --+
         |
        SSHConfig


Representation of config information as stored in the format used by OpenSSH. Queries can be made via lookup. The format is described in OpenSSH's ssh_config man page. This class is provided primarily as a convenience to posix users (since the OpenSSH format is a de-facto standard on posix) but should work fine on Windows too.

Since: 1.6

Method Summary
  __init__(self)
Create a new OpenSSH config object.
  lookup(self, hostname)
Return a dict of config options for a given hostname.
  parse(self, file_obj)
Read an OpenSSH config from the given file object.
    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
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Method Details

__init__(self)
(Constructor)

Create a new OpenSSH config object.
Overrides:
__builtin__.object.__init__

lookup(self, hostname)

Return a dict of config options for a given hostname.

The host-matching rules of OpenSSH's ssh_config man page are used, which means that all configuration options from matching host specifications are merged, with more specific hostmasks taking precedence. In other words, if "Port" is set under "Host *" and also "Host *.example.com", and the lookup is for "ssh.example.com", then the port entry for "Host *.example.com" will win out.

The keys in the returned dict are all normalized to lowercase (look for "port", not "Port". No other processing is done to the keys or values.
Parameters:
hostname - the hostname to lookup
           (type=str)

parse(self, file_obj)

Read an OpenSSH config from the given file object.
Parameters:
file_obj - a file-like object to read the config file from
           (type=file)

Generated by Epydoc 2.1 on Mon Jan 21 19:06:09 2008 http://epydoc.sf.net