Configuration

Configuration file (aka ssh_config) support.

class paramiko.config.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.

New in version 1.6.

SETTINGS_REGEX = <_sre.SRE_Pattern object at 0x105fbdb10>
__init__()

Create a new OpenSSH config object.

parse(file_obj)

Read an OpenSSH config from the given file object.

Parameters:file_obj (file) – a file-like object to read the config file from
lookup(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". The values are processed according to the rules for substitution variable expansion in ssh_config.

Parameters:hostname (str) – the hostname to lookup
__weakref__

list of weak references to the object (if defined)

class paramiko.config.LazyFqdn(config, host=None)

Returns the host’s fqdn on request as string.

__weakref__

list of weak references to the object (if defined)

Paramiko

A Python implementation of SSHv2.

https://secure.travis-ci.org/paramiko/paramiko.png?branch=master

Navigation


Donate

Consider supporting the authors on Gratipay: