ssh feature. See SSH for usage flows.
Sandbox
sb.ssh()
Example
Example
connect or server.
Returns
SSH namespace for this sandbox.
SandboxSshOps
Returned by sb.ssh()
SSH operations for a sandbox.ssh.connect()
Example
Example
root, terminal from $TERM, SFTP enabled).
Returns
Connected SSH client session.
ssh.open_client()
connect.
Returns
Connected SSH client session.
ssh.connect_with()
Example
Example
Parameters
Configure user, terminal, SFTP support, and the inactivity timeout.
Returns
Connected SSH client session.
ssh.open_client_with()
connect_with.
Parameters
Configure user, terminal, SFTP support, and the inactivity timeout.
Returns
Connected SSH client session.
ssh.server()
Example
Example
SshServer is cloneable and can serve many connections.
Returns
Reusable SSH server endpoint.
ssh.prepare_server()
server.
Returns
Reusable SSH server endpoint.
ssh.server_with()
Example
Example
Parameters
Configure host key, authorized keys, guest user, SFTP, and the inactivity timeout.
Returns
Reusable SSH server endpoint.
ssh.prepare_server_with()
server_with.
Parameters
Configure host key, authorized keys, guest user, and SFTP.
Returns
Reusable SSH server endpoint.
SshClient
Returned by ssh.connect(), ssh.connect_with()
Native in-process SSH client session.client.exec()
Example
Example
/bin/sh -c). No PTY is requested.
Parameters
commandimpl Into<String>Command string sent through SSH.
Returns
Captured output and exit status.
client.exec_with()
Example
Example
tty; when a PTY is allocated, stderr is folded into stdout.
Parameters
commandimpl Into<String>Command string sent through SSH.
Configure exec options.
Returns
Captured output and exit status.
client.attach()
Example
Example
Returns
i32
Shell exit code (128 if terminated by signal).
client.attach_with()
Example
Example
Parameters
Configure terminal name and detach keys.
Returns
i32
Shell exit code (128 if terminated by signal).
client.sftp()
Example
Example
sftp subsystem and returns a high-level SFTP session for reading, writing, and listing files inside the guest.
Returns
SFTP client session.
client.close()
Example
Example
SshServer
Returned by ssh.server(), ssh.server_with()
Reusable SSH server endpoint for a sandbox.server.serve()
Example
Example
Parameters
streamS: AsyncRead + AsyncWriteOrdered duplex SSH transport.
server.serve_connection()
serve.
Parameters
streamS: AsyncRead + AsyncWriteOrdered duplex SSH transport.
SshStdioStream
Used by server.serve()
Ordered duplex stream backed by this process’s stdin and stdout. ImplementsAsyncRead and AsyncWrite.
SshStdioStream::new()
Example
Example
AsyncRead and AsyncWrite, so it can be passed straight to serve to bridge an SSH connection over the parent process’s standard streams. Also available via Default.
Returns
Duplex stream over stdin/stdout.
Constants
DEFAULT_SSH_HOST
DEFAULT_SSH_PORT
SshClientOptionsBuilder
Used by ssh.connect_with()
Builder for SSH client options. Defaults: userroot, terminal from $TERM (falling back to xterm), SFTP enabled, and the global SSH inactivity timeout.
client_options.user()
root.
client_options.term()
client_options.sftp()
true.
client_options.inactivity_timeout()
Duration::ZERO disables it.
client_options.disable_inactivity_timeout()
client_options.build()
SshExecOptionsBuilder
Used by client.exec_with()
Builder for SSH exec options.exec_options.tty()
false.
exec_options.build()
SshAttachOptionsBuilder
Used by client.attach_with()
Builder for interactive SSH attach options. Default terminal comes from$TERM (falling back to xterm); detach keys default to the standard sequence.
attach_options.term()
attach_options.detach_keys()
attach_options.build()
SshServerOptionsBuilder
Used by ssh.server_with()
Builder for SSH server options. SFTP is enabled by default; the inactivity timeout inherits the global SSH setting; when no authorized keys are provided, the default authorized-keys file is loaded.server_options.host_key_path()
server_options.host_key()
server_options.authorized_keys_path()
server_options.authorized_key()
server_options.user()
server_options.sftp()
true.
server_options.inactivity_timeout()
Duration::ZERO disables it.
server_options.disable_inactivity_timeout()
server_options.build()
SftpClient
Returned by client.sftp()
High-level SFTP client session.Types
SshOutput
Returned by client.exec(), client.exec_with()
Output from an SSH exec request.