ssh

package
v2.58.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 20 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSSHArgs added in v2.57.0

func BuildSSHArgs(opts SSHOptions) []string

BuildSSHArgs returns the arguments for the ssh command

func ConnectWithFallback added in v2.57.0

func ConnectWithFallback(users []string, connect func(user string) (int, string, error), onRetry func(next string)) (int, error)

ConnectWithFallback runs connect for each user until it succeeds, or fails for another reason than the authentication. It returns the result of the last attempt

func IsAuthFailure added in v2.57.0

func IsAuthFailure(exitCode int, stderr string) bool

IsAuthFailure returns true if ssh failed to authenticate. ssh uses the exit code 255 for its own errors, and prints "Permission denied (<methods>)" when all authentication methods failed

func SSHUsers added in v2.57.0

func SSHUsers(user, fallbackUser string) []string

SSHUsers returns the users to try in order. The fallback user is only tried if no user was given, as ssh then uses the local user name, which often doesn't exist on the device

Types

type CmdSSH

type CmdSSH struct {
	*subcommand.SubCommand
	// contains filtered or unexported fields
}

func NewCmdSSH

func NewCmdSSH(f *cmdutil.Factory) *CmdSSH

func (*CmdSSH) GetPortForwarding added in v2.47.0

func (n *CmdSSH) GetPortForwarding() string

func (*CmdSSH) RunE

func (n *CmdSSH) RunE(cmd *cobra.Command, args []string) error

type SSHOptions added in v2.57.0

type SSHOptions struct {
	Host           string
	Port           string
	User           string
	PreferredAuth  string
	Batch          bool
	PortForwarding string
	Command        []string
}

SSHOptions options to build the ssh command

Jump to

Keyboard shortcuts

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