{"id":13667957,"url":"https://github.com/1148118271/ssh-rs","last_synced_at":"2026-03-17T20:04:12.497Z","repository":{"id":39669276,"uuid":"442675451","full_name":"1148118271/ssh-rs","owner":"1148118271","description":"Rust implementation of ssh2.0 client 👻 rust实现的ssh2.0客户端","archived":false,"fork":false,"pushed_at":"2024-07-01T13:17:34.000Z","size":758,"stargazers_count":151,"open_issues_count":20,"forks_count":29,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-14T01:58:20.170Z","etag":null,"topics":["rust","ssh","ssh-client","ssh2"],"latest_commit_sha":null,"homepage":"https://docs.rs/ssh-rs/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1148118271.png","metadata":{"files":{"readme":"README.md","changelog":"changelog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-29T05:59:52.000Z","updated_at":"2025-08-27T15:30:45.000Z","dependencies_parsed_at":"2023-10-17T06:21:05.907Z","dependency_job_id":"096ed463-512c-42cd-b553-174bb226898b","html_url":"https://github.com/1148118271/ssh-rs","commit_stats":{"total_commits":286,"total_committers":7,"mean_commits":"40.857142857142854","dds":"0.32867132867132864","last_synced_commit":"0e85a0455e3d8defe142c146fdeed7d5de745d9b"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/1148118271/ssh-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1148118271%2Fssh-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1148118271%2Fssh-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1148118271%2Fssh-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1148118271%2Fssh-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1148118271","download_url":"https://codeload.github.com/1148118271/ssh-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1148118271%2Fssh-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30630037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust","ssh","ssh-client","ssh2"],"created_at":"2024-08-02T07:00:56.006Z","updated_at":"2026-03-17T20:04:12.480Z","avatar_url":"https://github.com/1148118271.png","language":"Rust","readme":"# ssh-rs ✨\n\n[![Build](https://github.com/1148118271/ssh-rs/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/1148118271/ssh-rs/actions/workflows/build.yml)\n[![API Docs](https://docs.rs/ssh-rs/badge.svg)](https://docs.rs/ssh-rs/latest/)\n[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\n[English](https://github.com/1148118271/ssh-rs/blob/main/README.md)  |  [简体中文](https://github.com/1148118271/ssh-rs/blob/main/README_ZH.md)\n\nRust implementation of ssh2.0 client.\n\nIf you encounter any problems in use, welcome [issues](https://github.com/1148118271/ssh-rs/issues)\nor [PR](https://github.com/1148118271/ssh-rs/pulls) .\n\n## Content\n\n\u003c!-- @import \"[TOC]\" {cmd=\"toc\" depthFrom=1 depthTo=6 orderedList=false} --\u003e\n\n\u003c!-- code_chunk_output --\u003e\n\n* [ssh-rs ✨](#ssh-rs)\n  + [Content](#content)\n  + [Connection method：](#connection-method)\n    - [1. Password:](#1-password)\n    - [2. Public key:](#2-public-key)\n      - [1. Use key file path：](#1-use-key-file-path)\n      - [2. Use key string：](#2-use-key-string)\n      - [3. Use them together](#3-use-them-together)\n  + [Enable global logging：](#enable-global-logging)\n  + [Set timeout：](#set-timeout)\n  + [How to use：](#how-to-use)\n  + [Algorithm support：](#algorithm-support)\n    - [1. Kex algorithms](#1-kex-algorithms)\n    - [2. Server host key algorithms](#2-server-host-key-algorithms)\n    - [3. Encryption algorithms (client to server)](#3-encryption-algorithms-client-to-server)\n    - [4. Encryption algorithms (server to client)](#4-encryption-algorithms-server-to-client)\n    - [5. Mac algorithms (client to server)](#5-mac-algorithms-client-to-server)\n    - [6. Mac algorithms (server to client)](#6-mac-algorithms-server-to-client)\n    - [7. Compression algorithms (client to server)](#7-compression-algorithms-client-to-server)\n    - [8. Compression algorithms (server to client)](#8-compression-algorithms-server-to-client)\n    - [☃️ Additional algorithms will continue to be added.](#️-additional-algorithms-will-continue-to-be-added)\n\n\u003c!-- /code_chunk_output --\u003e\n\n## Connection method：\n\n### 1. Password:\n\n```rust\nuse ssh;\n\nlet mut session = ssh::create_session()\n    .username(\"ubuntu\")\n    .password(\"password\")\n    .connect(\"127.0.0.1:22\")\n    .unwrap();\n```\n\n### 2. Public key:\n\n* **Currently, only RSA, ED25519 keys/key files are supported.**\n\n#### 1. Use key file path：\n\n```rust\n// pem format key path -\u003e /xxx/xxx/id_rsa\n// the content of the keyfile shall begin with\n//      -----BEGIN RSA PRIVATE KEY----- / -----BEGIN OPENSSH PRIVATE KEY-----\n// and end with\n//       -----END RSA PRIVATE KEY----- / -----END OPENSSH PRIVATE KEY-----\n// simply generated by `ssh-keygen -t rsa -m PEM -b 4096`\nuse ssh;\n\nlet mut session = ssh::create_session()\n    .username(\"ubuntu\")\n    .private_key_path(\"./id_rsa\")\n    .connect(\"127.0.0.1:22\")\n    .unwrap();\n```\n\n#### 2. Use key string：\n\n```rust\n// pem format key string:\n//      -----BEGIN RSA PRIVATE KEY----- / -----BEGIN OPENSSH PRIVATE KEY-----\n// and end with\n//       -----END RSA PRIVATE KEY----- / -----END OPENSSH PRIVATE KEY-----\nuse ssh;\n\nlet mut session = ssh::create_session()\n    .username(\"ubuntu\")\n    .private_key(\"rsa_string\")\n    .connect(\"127.0.0.1:22\")\n    .unwrap();\n```\n\n#### 3. Use them together\n\n* According to the implementation of OpenSSH, it will try public key first and fallback to password. So both of them can be provided.\n\n```Rust\nuse ssh;\n\nlet mut session = ssh::create_session()\n    .username(\"username\")\n    .password(\"password\")\n    .private_key_path(\"/path/to/rsa\")\n    .connect(\"127.0.0.1:22\")\n    .unwrap();\n```\n\n## Enable global logging：\n\n* This crate now uses the `log` compatible `tracing` for logging functionality\n\n```rust\nuse tracing::Level;\nuse tracing_subscriber::FmtSubscriber;\n\n// this will generate some basic event logs\n// a builder for `FmtSubscriber`.\nlet subscriber = FmtSubscriber::builder()\n    // all spans/events with a level higher than INFO (e.g, info, warn, etc.)\n    // will be written to stdout.\n    .with_max_level(Level::INFO)\n    // completes the builder.\n    .finish();\n\ntracing::subscriber::set_global_default(subscriber).expect(\"setting default subscriber failed\");\n```\n\n## Set timeout：\n\n* Only global timeouts per r/w are currently supported.\n\n```rust\nuse ssh;\n\nlet _listener = TcpListener::bind(\"127.0.0.1:7777\").unwrap();\n\nmatch ssh::create_session()\n    .username(\"ubuntu\")\n    .password(\"password\")\n    .private_key_path(\"./id_rsa\")\n    .timeout(Some(std::time::Duration::from_secs(5)))\n    .connect(\"127.0.0.1:7777\")\n{\n    Err(e) =\u003e println!(\"Got error {}\", e),\n    _ =\u003e unreachable!(),\n}\n```\n\n## How to use：\n\n* Examples can be found under [examples](examples)\n\n1. [Execute a command](examples/exec/src/main.rs)\n2. [Scp files](examples/scp/src/main.rs)\n3. [Run a shell](examples/shell/src/main.rs)\n4. [Run an interactive shell](examples/shell_interactive/src/main.rs)\n5. [Connect ssh server w/o a tcp stream](examples/bio/src/main.rs)\n6. [Cofigure your own algorithm list](examples/customized_algorithms/src/main.rs)\n\n## Algorithm support：\n\n### 1. Kex algorithms\n\n* `curve25519-sha256`\n* `ecdh-sha2-nistp256`\n* `diffie-hellman-group14-sha256`\n* `diffie-hellman-group14-sha1`\n* `diffie-hellman-group1-sha1` (behind feature \"deprecated-dh-group1-sha1\")\n\n### 2. Server host key algorithms\n\n* `ssh-ed25519`\n* `rsa-sha2-256`\n* `rsa-sha2-512`\n* `rsa-sha` (behind feature \"deprecated-rsa-sha1\")\n* `ssh-dss` (behind feature \"deprecated-dss-sha1\")\n\n\n### 3. Encryption algorithms\n\n* `chacha20-poly1305@openssh.com`\n* `aes128-ctr`\n* `aes192-ctr`\n* `aes256-ctr`\n* `aes128-cbc` (behind feature \"deprecated-aes-cbc\")\n* `aes192-cbc` (behind feature \"deprecated-aes-cbc\")\n* `aes256-cbc` (behind feature \"deprecated-aes-cbc\")\n* `3des-cbc` (behind feature \"deprecated-des-cbc\")\n\n### 4. Mac algorithms\n\n* `hmac-sha2-256`\n* `hmac-sha2-512`\n* `hmac-sha1`\n\n### 5. Compression algorithms\n\n* `none`\n* `zlib@openssh.com`\n* `zlib` (behind feature \"zlib\")\n\n---\n\n### ☃️ Additional algorithms will continue to be added.\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1148118271%2Fssh-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1148118271%2Fssh-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1148118271%2Fssh-rs/lists"}