sudo

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package sudo is policy-free plumbing for driving an interactive sudo over an ssh transport without either (a) carrying a password

Index

Constants

This section is empty.

Variables

View Source
var ErrNoTTY = errors.New("sudo: no controlling tty; cannot prompt for password")

ErrNoTTY is returned by ReadPassword when /dev/tty cannot be opened. CI and headless invocations should fail fast on this rather than hang

Functions

func PasswordRequired

func PasswordRequired(stderr string) bool

PasswordRequired returns true when stderr from a `sudo -n` attempt indicates the failure was "password needed" rather than a genuine

func ReadPassword

func ReadPassword(prompt string) ([]byte, error)

ReadPassword prompts on /dev/tty (NOT stdin, which the caller will reuse to pipe the password into the remote sudo) and returns the

func Zero

func Zero(b []byte)

Zero overwrites b in place. Use with `defer` after a successful ReadPassword to keep the password-bearing buffer alive only as long

Types

This section is empty.

Jump to

Keyboard shortcuts

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