Easy to use SSH client functionality with an asynchronous API (async/await), built on swift-nio-ssh.
SshClient
currently provides the following functionality:
- Opening an SSH connection.
- Executing a command remotely.
- Getting an AsyncSequence with stdout and/or stderr output lines from the remote command.
A simple example of setting up an SSH connection and executing a remote command:
let sshConnection = try await SshClient().connect(host: "10.0.0.1", username: "username")
let remoteProcess = try await sshConnection.execute("ls")
for await line in remoteProcess.stdOutLines {
print(line)
}
For detailed documentation, please see: SshClient documentation.
To use SshClient
in a SwiftPM project, add the following
line to the dependencies in your Package.swift
file:
.package(url: "https://github.com/orobio/SshClient", from: "0.1.0"),
Include "SshClient"
as a dependency for your executable target:
.target(name: "<target>", dependencies: [
"SshClient",
]),
Finally, add import SshClient
to your source code.
This package does not have a stable 1.0.0 release yet. Public API can change at any time.