sshcopyid

package
v0.0.0-...-1aef7fd Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package sshcopyid provides the ssh-copy-id utility — install a public key on a remote server's authorized_keys file.

It exposes a Config struct with a Parse method for command-line argument parsing, and a Run function that copies the key using an SSH connection resolved through pkg/sshclient.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadPublicKey

func LoadPublicKey(identityFile string) ([]byte, string, error)

LoadPublicKey reads the public key to install. Tries (in order): the specified -i file, agent keys, default key files.

func Run

func Run(cfg *Config, streams stdio.TerminalStreams, lgr sshclient.Logger) int

Run executes the ssh-copy-id action based on cfg and returns a process exit code.

Types

type Config

type Config struct {
	IdentityFile string   // -i
	Port         string   // -p
	ConfigFile   string   // -F
	Options      []string // -o (repeatable)
	DryRun       bool     // -n
	ForceInstall bool     // -f
	Destination  string   // user@host positional argument
	Version      bool     // -V
}

Config holds parsed ssh-copy-id command-line arguments.

func (*Config) Parse

func (cfg *Config) Parse(args ...string) error

Parse populates cfg from command-line arguments. Fields set before calling Parse are preserved unless overridden.

Jump to

Keyboard shortcuts

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