ssh

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2025 License: BSD-2-Clause Imports: 8 Imported by: 0

README

The ssh package provides a single module:

SSH

This module establishes an SSH connection to the DUT from the dutagent and executes a command.

ARGUMENTS:
    [command-string]

The connection is closed after the passed command is executed.
The command-string is passed to the shell as a single argument. The command-string must not contain any newlines.
Quote the command-string if it contains spaces or special characters. E.g.: "ls -l /tmp"

The module supports password and key-pair authentication. At least one needs to be configured. If both are configured, key-pair authentication is preferred and password authentication is used as fallback.

Optionally, the public key of the server to connect to (intentionally the DUT) can be set to be used during SSH handshake. If unset, any host key will be accepted.

See ssh-example-cfg.yml for examples.

Configuration Options

Option Value Description
host string Hostname or IP address of the DUT
port int Port number of the SSH server on the DUT (default: 22)
user string Username for the SSH connection (default: "root")
password string Password for the SSH connection
privatekey string Path to the dutagent's private key file
hostkey string Server's host key in the format [key_type] [base64_encoded_key]

Documentation

Overview

Package ssh provides a dutagent module that connects to the DUT via Secure Shell and executes commands that are passed to the module from the dutctl client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SSH

type SSH struct {
	Host       string // Host is the hostname or IP address of the DUT.
	Port       int    // Port is the port number of the SSH server on the DUT. Default is 22.
	User       string // User is the username to use for the SSH connection. Default is "root".
	Password   string // Password is the password to use for the SSH connection. Default is "".
	PrivateKey string // PrivateKey is the path to the dutagent's private key file.
	HostKey    string // HostKey is the server host key to use for the SSH connection.
	// contains filtered or unexported fields
}

SSH is a module that executes commands on a remote host. It is non-interactive and closes the connection after the passed command is executed.

func (*SSH) Deinit

func (s *SSH) Deinit() error

func (*SSH) Help

func (s *SSH) Help() string

func (*SSH) Init

func (s *SSH) Init() error

func (*SSH) Run

func (s *SSH) Run(_ context.Context, sesh module.Session, args ...string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL