Documentation ¶
Index ¶
- Variables
- func CheckSudoNeedsPassword(client *ssh.Client) (bool, error)
- func SudoRun(client *ssh.Client, passwordCallback SudoPasswordCallback, command ...string) (io.WriteCloser, io.Reader, io.Reader, *ssh.Session, error)
- func SudoShell(client *ssh.Client, passwordCallback SudoPasswordCallback) (io.WriteCloser, io.Reader, io.Reader, *ssh.Session, error)
- type PasswordCallbackFailureError
- type SudoPasswordCallback
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoReadyFlag = errors.New("no READY flag found when expected")
View Source
var ErrNoSudoPrompt = errors.New("no sudo prompt found when expected")
Functions ¶
func SudoRun ¶
func SudoRun(client *ssh.Client, passwordCallback SudoPasswordCallback, command ...string) ( io.WriteCloser, io.Reader, io.Reader, *ssh.Session, error, )
run a command with sudo over the ssh client
passwordCallback will be called if a sudo password is needed.
the command will be run in a shell with all elements quoted to prevent word splitting or expansion. use eval to achieve this if needed.
Types ¶
type PasswordCallbackFailureError ¶
type PasswordCallbackFailureError struct {
// contains filtered or unexported fields
}
func (PasswordCallbackFailureError) Error ¶
func (e PasswordCallbackFailureError) Error() string
func (PasswordCallbackFailureError) Is ¶
func (e PasswordCallbackFailureError) Is(target error) bool
func (PasswordCallbackFailureError) Unwrap ¶
func (e PasswordCallbackFailureError) Unwrap() error
type SudoPasswordCallback ¶
func SudoStaticPasswordCallback ¶
func SudoStaticPasswordCallback(pwd string) SudoPasswordCallback
Click to show internal directories.
Click to hide internal directories.