ssh

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DirPath is the path of the default SSH directory.
	DirPath = ".ssh"

	// AuthorizedKeysPath is the path of the default authorized_keys file for SSH.
	AuthorizedKeysPath = ".ssh/authorized_keys"
)

Functions

func AuthorizeKeys

func AuthorizeKeys(authorizedKeysFile *os.File, publicKeys ...Key) error

AuthorizeKeys appends the given SSH public keys to the given os.File.

func AuthorizeKeysFor

func AuthorizeKeysFor(usr *user.User, publicKeys []Key) error

AuthorizeKeysFor initializes the SSH directory structure for the user and appends the given public keys to user's authorized keys file.

func InitializeFor

func InitializeFor(usr *user.User) error

InitializeFor checks whether .ssh directory exists in the given user's home directory and creates the directory if it doesn't exist.

func Verify

func Verify(key Key) error

Verify uses 'ssh-keygen' utility to verify an SSH key. It returns an error if a problem occurs or the key is invalid. The caller should diagnose the error for more information.

Types

type Key

type Key []byte

Key is an SSH key public or private.

type KeyPair

type KeyPair struct {
	Public  Key
	Private Key
}

KeyPair is an SSH keypair, public and private.

Jump to

Keyboard shortcuts

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