Categorygithub.com/stephane-martin/golang-ssh
modulepackage
0.7.3
Repository: https://github.com/stephane-martin/golang-ssh.git
Documentation: pkg.go.dev

# README

Origin README see here

This ssh package contains helpers for working with ssh in go. The client.go file is a modified version of docker/machine/libmachine/ssh/client.go that only uses golang's native ssh client. It has also been improved to resize the tty as needed. The key functions are meant to be used by either client or server and will generate/store keys if not found.

Usage:

package main

import (
	"fmt"

	"github.com/nanobox-io/golang-ssh"
)

func main() {
	err := connect()
	if err != nil {
		fmt.Printf("Failed to connect - %s\n", err)
	}
}

func connect() error {
    client, err := ssh.NewNativeClient("user", "localhost", "SSH-2.0-MyCustomClient-1.0", 2222, nil, ssh.AuthPassword("pass"))
	if err != nil {
		return fmt.Errorf("Failed to create new client - %s", err)
	}

	err = client.Shell()
	if err != nil && err.Error() != "exit status 255" {
		return fmt.Errorf("Failed to request shell - %s", err)
	}

	return nil
}

# Functions

AuthCert creates an AuthMethod for SSH certificate authentication from the key and certificate bytes.
AuthCertFile creates an AuthMethod for SSH certificate authentication from the key and certicate files.
AuthKey creates an AuthMethod for SSH key authentication.
AuthKey creates an AuthMethod for SSH key authentication from a key file.
AuthPassword creates an AuthMethod for password authentication.
No description provided by the author
GenKeyPair make a pair of public and private keys for SSH access.
No description provided by the author
No description provided by the author
Output returns the output of the command run on the remote host.
Output returns the output of the command run on the remote host as well as a pty.
No description provided by the author
No description provided by the author
Shell requests a shell from the remote.
StartCommand starts the specified command without waiting for it to finish.

# Structs

No description provided by the author
No description provided by the author
ExitError is a convenience wrapper for (crypto/ssh).ExitError type.
No description provided by the author

# Interfaces

No description provided by the author