host

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const GroupExistExit = 9

man GROUPADD(8), exit codes section

View Source
const UserExistExit = 9

man USERADD(8), exit codes section

View Source
const UserLoggedInExit = 8

Variables

View Source
var ErrInvalidSudoers = errors.New("visudo: invalid sudoers file")

Functions

func AddUserToGroups

func AddUserToGroups(username string, groups []string) (exitCode int, err error)

AddUserToGroups adds a user to a list of specified groups on a host using `usermod`

func CheckSudoers

func CheckSudoers(contents []byte) error

CheckSudoers tests a suders file using `visudo`. The contents are written to the process via stdin pipe.

func GetAllUsers

func GetAllUsers() ([]string, int, error)

func GroupAdd

func GroupAdd(groupname string, gid string) (exitCode int, err error)

GroupAdd creates a group on a host using `groupadd` optionally specifying the GID to create the group with.

func UserAdd

func UserAdd(username string, groups []string, home, uid, gid string) (exitCode int, err error)

UserAdd creates a user on a host using `useradd`

func UserDel

func UserDel(username string) (exitCode int, err error)

UserDel deletes a user on a host using `userdel`.

Types

This section is empty.

Jump to

Keyboard shortcuts

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