sshcommand

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Host                string
	User                string
	Port                int
	SSHOptions          []string
	Gateway             *Command
	Command             []string
	Debug               bool
	NoEscapeCommand     bool
	SkipHostKeyChecking bool
	Quiet               bool
	AllocateTTY         bool
	// contains filtered or unexported fields
}

Command contains settings to build a ssh command

Example
Output:

Example (Complex)
Output:

Example (Gateway)
Output:

Example (Options)
Output:

func New

func New(host string) *Command

New returns a minimal Command

Example
Output:

func (*Command) Slice

func (c *Command) Slice() []string

Slice returns an execve compatible slice of arguments

Example
Output:

[ssh 1.2.3.4 -p 22]
Example (Complex)
Output:

["ssh" "-q" "-o" "UserKnownHostsFile=/dev/null" "-o" "StrictHostKeyChecking=no" "-o" "ProxyCommand=ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -W %h:%p -l toor 5.6.7.8 -t -t -p 22" "1.2.3.4" "-t" "-t" "-p" "22" "--" "/bin/sh" "-e" "-c" "\"echo hello world\""]
Example (Gateway)
Output:

["ssh" "-o" "ProxyCommand=ssh -W %h:%p 5.6.7.8 -p 22" "1.2.3.4" "-p" "22"]
Example (Options)
Output:

["ssh" "-q" "-o" "UserKnownHostsFile=/dev/null" "-o" "StrictHostKeyChecking=no" "-l" "root" "1.2.3.4" "-t" "-t" "-p" "22" "--" "/bin/sh" "-e" "-x" "-c" "\"\\\"echo\\\" \\\"hello world\\\"\""]
Example (User)
Output:

[ssh -l root 1.2.3.4 -p 22]

func (*Command) String

func (c *Command) String() string

String returns a copy-pasteable command, useful for debugging

Example
Output:

ssh 1.2.3.4 -p 22
Example (Complex)
Output:

ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o "ProxyCommand=ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -W %h:%p -l toor 5.6.7.8 -t -t -p 22" 1.2.3.4 -t -t -p 22 -- /bin/sh -e -c "\"\\\"echo\\\" \\\"hello world\\\"\""
Example (Options)
Output:

ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no 1.2.3.4 -t -t -p 22 -- /bin/sh -e -x -c "\"\\\"echo\\\" \\\"hello world\\\"\""

Jump to

Keyboard shortcuts

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