utils

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanControl

func CanControl(username string) bool

check if the current user can do "something" with the selected component

just check if running as root or if a username is specified in the config that the current user matches.

this does not however change the user to match anything, so starting a process still requires a seteuid type change

func Dir

func Dir(path string) string

func GetIDs

func GetIDs(username string) (uid, gid int, gids []int, err error)

func IsSuperuser

func IsSuperuser() bool

func JoinSlash

func JoinSlash(elem ...string) string

JoinSlash returns a file path joined but with slashes (to support Windows looking for remote paths on Linux)

func SetUser

func SetUser(cmd *exec.Cmd, username string) (err error)

set-up the Cmd to set uid, gid and groups of the username given Note: does not change stdout etc. which is done later

Types

This section is empty.

Jump to

Keyboard shortcuts

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