remotelinux

package
v0.0.0-...-84310d3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Become

func Become(host *server.Host, in string) string

Become rewrites the command to become another user

func BecomeSCP

func BecomeSCP(host *server.Host, in *scp.SCP) *scp.SCP

BecomeSCP configures the scp to run with sudo

Types

type Backend

type Backend struct {
	*server.Host
}

Backend for a remote linux host

func (Backend) NewSession

func (b Backend) NewSession(session server.Session, host *server.Host) (server.HostSession, error)

NewSession returns a new session to the host

type RemoteSession

type RemoteSession struct {
	*ssh.Session

	Client        *sshdial.Client
	Host          *server.Host
	ServerSession server.Session
}

RemoteSession is a wrapper around ssh session

func (*RemoteSession) Chmod

func (b *RemoteSession) Chmod(path string, mode int) (server.CmdErr, error)

Chmod changes file mode

func (*RemoteSession) Chown

func (b *RemoteSession) Chown(path, u, g string) (server.CmdErr, error)

Chown changes file owner

func (*RemoteSession) Close

func (b *RemoteSession) Close()

Close closes a session

func (*RemoteSession) GetFileInfo

func (b *RemoteSession) GetFileInfo(file string) (server.FileOwner, os.FileInfo, server.CmdErr, error)

GetFileInfo retrieves file info from a host

func (*RemoteSession) MkDir

func (b *RemoteSession) MkDir(path string) (server.CmdErr, error)

MkDir creates dir

func (*RemoteSession) ReadFile

func (b *RemoteSession) ReadFile(name string) (os.FileInfo, []byte, server.CmdErr, error)

ReadFile reads a remote file via scp

func (*RemoteSession) Run

Run runs a command on a remote host via ssh

func (*RemoteSession) RunShellCommand

func (b *RemoteSession) RunShellCommand(cmd string, env map[string]string) ([]byte, []byte, int, error)

RunShellCommand runs a command at a shell on the remote host. Returns the output and error

func (*RemoteSession) WriteFile

func (b *RemoteSession) WriteFile(name string, perms os.FileMode, content []byte) (server.CmdErr, error)

WriteFile writes a remote file via scp

Jump to

Keyboard shortcuts

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