#ssh #config #libssh2 #libssh

ssh_config

A small package to parse OpenBSD ssh_config config files The motivation for this crate is that libssh2 does not have a ssh_config parser, and there aren't any decent bindings to libssh

1 unstable release

0.1.0 Jan 10, 2020

#4 in #libssh

Download history 1/week @ 2024-11-13 3/week @ 2024-11-20 2/week @ 2024-11-27 6/week @ 2024-12-04 16/week @ 2024-12-11 1/week @ 2025-01-29 20/week @ 2025-02-05 9/week @ 2025-02-12 10/week @ 2025-02-19 19/week @ 2025-02-26

58 downloads per month
Used in 3 crates (via astu-action)

MPL-2.0 license

26KB
567 lines

ssh_config

A small library to parse OpenBSD ssh_config files.

More documentation on the file format can be found in the OpenBSD man pages.

Usage example

use ssh_config::SSHConfig;

let config = SSHConfig::parse_str(r#"
Host test-host
  Port 22
  Username user
"#)?;

let host_settings = config.query("test-host");
assert_eq!(host_settings["Port"], "22");
assert_eq!(host_settings["Username"], "User");

License

This library is licensed under the Mozilla Public License, v. 2.0. The license file can be found in LICENSE.


lib.rs:

ssh_config

A crate to parse OpenBSD ssh_config files

Usage

Using this crate involves parsing a ssh_config file and querying the resulting SSHConfig object for host definitions

use ssh_config::SSHConfig;

let config = SSHConfig::parse_str(r#"
Host test-host
  Port 22
  Username user
"#)?;

let host_settings = config.query("test-host");
assert_eq!(host_settings["Port"], "22");
assert_eq!(host_settings["Username"], "User");

No runtime deps