Toggle navigation


Configuration file (aka ssh_config) support.

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

Returns the host's fqdn on request as string.


list of weak references to the object (if defined)

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.


Create a new OpenSSH config object.


list of weak references to the object (if defined)


Return the set of literal hostnames defined in the SSH config (both explicit hostnames and wildcard entries).


Return a dict of config options for a given hostname.

The host-matching rules of OpenSSH's ssh_config man page are used: For each parameter, the first obtained value will be used. The configuration files contain sections separated by Host specifications, and that section is only applied for hosts that match one of the patterns given in the specification.

Since the first obtained value for each parameter is used, more host- specific declarations should be given near the beginning of the file, and general defaults at the end.

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.

hostname (str) -- the hostname to lookup

Read an OpenSSH config from the given file object.

file_obj -- a file-like object to read the config file from