SSH Config

class ssh2.config.SSHConfigData(hostname: str, port: int = 22, username: Optional[str] = None, password: Optional[str] = None, key_filename: Optional[str] = None, timeout: Optional[int] = None, allow_agent: bool = True, look_for_keys: bool = True, compress: bool = False, sock: Optional[Any] = None, gss_auth: bool = False, gss_kex: bool = False, gss_deleg_creds: bool = True, gss_host: Optional[str] = None, gss_trust_dns: bool = True, banner_timeout: Optional[int] = None, auth_timeout: Optional[int] = None, passphrase: Optional[str] = None, disabled_algorithms: Optional[str] = None, use_ssh_config: bool = True, host_key_policy: Callable = <class 'paramiko.client.RejectPolicy'>, host_key_file: Optional[str] = None)[source]
Key hostname

The remote server to connect to.

Key port

The remote server port to connect to, defaults to 22.

Key username

The username to authenticate as.

Key password

The password to authenticate with.

Key key_filename

filename string (or list of filename strings) of optional private key(s) and/or certs to try for authentication.

Key timeout

An optional timeout (in seconds) for the TCP connection.

Key allow_agent

Enables/disables connecting to the SSH agent, defaults to True.

Key look_for_keys

Enables/disables searching for discoverable private key files in ~/.ssh/, defaults to True.

Key compress

Enables/disables compressions, defaults to False.

Key sock

A socket or socket-like object to use for communication to the target host.

Key gss_auth

Enables/disables GSS-API authentication, defaults to False.

Key gss_kex

Enables/disables GSS-API key exchange and user authentication, defaults to False.

Key gss_deleg_creds

Enables/disables delegatation of GSS-API client credentials, defaults to True.

Key gss_host

The targets name in the Kerberos database, defaults to None.

Key gss_trust_dns

Indicates whether or not the DNS is trusted to securely canonicalize the name of the host being connected to, defaults to True.

Key banner_timeout

An optional timeout (in seconds) to wait for the SSH banner to be presented.

Key auth_timeout

An optional timeout (in seconds) to wait for an authentication response.

Key passphrase

Used for decrypting private keys.

Key disabled_algorithms

An optional dictionary passed directly to paramiko.Transport and its keyword argument of the same name.

Key use_ssh_config

Enables/disables reading the SSH configuration file.

Key host_key_policy

Indicates which SSH client or key policy to use, defaults to paramiko.RejectPolicy.

Key host_key_file

Host key file to read, defaults to None.

host_key_policy

alias of paramiko.client.RejectPolicy

load_ssh_config(config_file: Optional[str] = '~/.ssh/config') dict[source]

Loads SSH configuration properties.

Generates a dict with supported keyword/values from the ssh_config directives.

Parameters
  • hostname (str) – The remote server to connect to.

  • config_file (str) – The filename for the ssh_config. Default: ~/.ssh/config

Returns

A dict object with supported SSH configuration properties.

Raises

ssh2.errors.SSHConfigurationError