sshutil

package
v0.49.100 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ControlMasterArgs

func ControlMasterArgs() []string

ControlMasterArgs returns ssh flags enabling connection multiplexing. All ssh invocations for the same host (docker dial-stdio, tunnels, remote exec) share a single TCP/SSH connection: one handshake, then near-instant channel openings. This also avoids tripping sshd MaxStartups when many connections are opened concurrently.

func ParseSSHHost

func ParseSSHHost(host string) (user, addr string)

ParseSSHHost splits "user@host[:port][/]" into user and "host:port". User defaults to root, port to 22.

func SSHCommand

func SSHCommand(contextName, sshHost, remoteCmd string) *exec.Cmd

SSHCommand builds an ssh invocation running remoteCmd on sshHost, using the stored credentials of contextName (key, passphrase or password served via SSH_ASKPASS) and connection multiplexing.

func SSHCommandTTY

func SSHCommandTTY(contextName, sshHost, remoteCmd string) *exec.Cmd

SSHCommandTTY is like SSHCommand but forces a pseudo-terminal, for interactive remote commands (editors, shells).

func ShellQuote

func ShellQuote(s string) string

ShellQuote quotes s for safe interpolation in a remote shell command.

func SplitHostPort

func SplitHostPort(addr string) (string, string)

SplitHostPort splits "host:port", defaulting the port to 22.

Types

This section is empty.

Jump to

Keyboard shortcuts

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