Expand description
Simple async SSH client for Rust.
A lightweight, asynchronous library built on top of russh and russh-keys
that simplifies SSH operations such as executing remote commands, transferring
files via SCP, and interactive PTY sessions.
§Quick Start
use simple_ssh::Session;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mut ssh = Session::init()
.with_host("example.com")
.with_user("admin")
.with_passwd("secret")
.build()?
.connect()
.await?;
let code = ssh.cmd("ls -la").await?;
println!("Exit code: {}", code);
ssh.close().await?;
Ok(())
}§Features
- Execute remote commands (
cmd,exec,system) - Transfer files via SCP protocol
- Interactive PTY sessions with raw mode
- Programmatic PTY sessions via
PtyHandlefor TUI embedding - Public key, password, and certificate authentication
- IPv6 link-local address support
Re-exports§
pub use pty_mode::ModeChangeEvent;pub use pty_mode::ModeDetectionConfig;pub use pty_mode::ModeWatcher;pub use pty_mode::PtyMode;
Modules§
Structs§
- PtyBuilder
- Builder for configuring and executing PTY sessions with advanced options.
- PtyHandle
- A non-blocking, channel-based handle to a running remote PTY session.
- Session
- An SSH session handle that provides methods for executing commands, transferring files, and managing interactive shells.
- Session
Builder - Builder for configuring and creating an SSH
Session.
Enums§
- Pty
- Standard pseudo-terminal codes.
- PtyExit
Status - Represents the exit status of a PTY session.
- Sig
- The type of signals that can be sent to a remote process. If you plan to use custom signals, read the RFC to understand the encoding.