Struct openssh::SessionBuilder

source ·
pub struct SessionBuilder { /* private fields */ }
Expand description

Build a Session with options.

Implementations

Set the ssh user (ssh -l).

Defaults to None.

Set the port to connect on (ssh -p).

Defaults to None.

Set the keyfile to use (ssh -i).

Defaults to None.

See KnownHosts.

Default KnownHosts::Add.

Set the connection timeout (ssh -o ConnectTimeout).

This value is specified in seconds. Any sub-second duration remainder will be ignored. Defaults to None.

Set the timeout interval after which if no data has been received from the server, ssh will request a response from the server (ssh -o ServerAliveInterval).

This value is specified in seconds. Any sub-second duration remainder will be ignored. Defaults to None.

Available on non-Windows only.

Set the directory in which the temporary directory containing the control socket will be created.

If not set, ./ will be used (the current directory).

Set an alternative per-user configuration file.

By default, ssh uses ~/.ssh/config. This is equivalent to ssh -F <p>.

Defaults to None.

Enable or disable compression (including stdin, stdout, stderr, data for forwarded TCP and unix-domain connections, sftp and scp connections).

Note that the ssh server can forcibly disable the compression.

By default, ssh uses configure value set in ~/.ssh/config.

If ~/.ssh/config does not enable compression, then it is disabled by default.

Specify one or multiple jump hosts.

Connect to the target host by first making a ssh connection to the jump host described by destination and then establishing a TCP forwarding to the ultimate destination from there.

Multiple jump hops may be specified. This is a shortcut to specify a ProxyJump configuration directive.

Note that configuration directives specified by SessionBuilder do not apply to the jump hosts.

Use ~/.ssh/config to specify configuration for jump hosts.

Specify the path to the known_hosts file.

The path provided may use tilde notation (~) to refer to the user’s home directory.

The default is ~/.ssh/known_hosts and ~/.ssh/known_hosts2.

Available on crate feature process-mux only.

Connect to the host at the given host over SSH using process impl, which will spawn a new ssh process for each Child created.

The format of destination is the same as the destination argument to ssh. It may be specified as either [user@]hostname or a URI of the form ssh://[user@]hostname[:port]. A username or port that is specified in the connection string overrides the one set in the builder (but does not change the builder).

If connecting requires interactive authentication based on STDIN (such as reading a password), the connection will fail. Consider setting up keypair-based authentication instead.

Available on crate feature native-mux only.

Connect to the host at the given host over SSH using native mux, which will create a new local socket connection for each Child created.

See the crate-level documentation for more details on the difference between native and process-based mux.

The format of destination is the same as the destination argument to ssh. It may be specified as either [user@]hostname or a URI of the form ssh://[user@]hostname[:port]. A username or port that is specified in the connection string overrides the one set in the builder (but does not change the builder).

If connecting requires interactive authentication based on STDIN (such as reading a password), the connection will fail. Consider setting up keypair-based authentication instead.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.