sudo

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SudoRunShell

func SudoRunShell(shell ...string) *exec.Cmd

SudoRunShell 以管理员身份运行命令 **提前用 sudo -v 缓存密码再运行程序**

func SudoRunShellPasswordFromPipe

func SudoRunShellPasswordFromPipe(password string, shell ...string) (*exec.Cmd, io.WriteCloser, error)

SudoRunShellPasswordFromPipe 执行sudo,密码从管道中传入 **此方法不安全,可能会被其他进程通过管道截取到密码。或使用一些更安全的方法,比如 sudoers 文件或者 NOPASSWD 标志 或者提前用 sudo -v 缓存密码,再调用SudoRunShell** 如果需要传入参数,请使用返回的io.WriteCloser传入

Types

This section is empty.

Jump to

Keyboard shortcuts

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