Configuration

Paramiko does not itself leverage OpenSSH-style config file directives , but it does implement a parser for the format, which users can honor themselves (and is used by higher-level libraries, such as Fabric ).

The API for this is SSHConfig , which loads SSH config files from disk, file-like object, or string and exposes a “look up a hostname, get a dict of applicable keywords/values back” functionality.

As with OpenSSH’s own support, this dict will contain values from across the parsed file, depending on the order in which keywords were encountered and how specific or generic the Host or Match directives were.

Keywords currently supported

The following is an alphabetical list of which ssh_config directives Paramiko interprets during the parse/lookup process (as above, actual SSH connections do not reference parsed configs). Departures from OpenSSH’s implementation (e.g. to support backwards compat with older Paramiko releases) are included. A keyword by itself means no known departures.

  • AddressFamily : used when looking up the local hostname for purposes of expanding the %l / %L tokens (this is actually a minor value-add on top of OpenSSH, which doesn’t actually honor this setting when expanding %l ).

  • CanonicalDomains

    New in version 2.7.

  • CanonicalizeFallbackLocal : when no , triggers raising of CouldNotCanonicalize for target hostnames which do not successfully canonicalize.

    New in version 2.7.