users

package
v1.30.7 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 13 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoveUsersAndGroups

func RemoveUsersAndGroups() error

RemoveUsersAndGroups is a public wrapper around removeUsersAndGroupsImpl with default system file paths.

func UpdatePathOwner

func UpdatePathOwner(dirPath string, uid, gid int64) error

UpdatePathOwner recursively updates the owners of a directory. It is equivalent to calling `chown -R uid:gid /path/to/dir`.

func UpdatePathOwnerAndPermissions

func UpdatePathOwnerAndPermissions(path string, uid, gid int64, perms uint32) error

UpdatePathOwnerAndPermissions updates the owner and permissions of the given path. If the path is a directory it is not recursively updated.

Types

type EntryMap

type EntryMap struct {
	// contains filtered or unexported fields
}

EntryMap holds a map of user or group entries.

func (*EntryMap) ID

func (u *EntryMap) ID(name string) *int64

ID returns the ID for an entry based on the entry name. In case of a user entry it returns the user UID. In case of a group entry it returns the group GID. It returns nil if no such entry exists.

func (*EntryMap) String

func (u *EntryMap) String() string

String converts an EntryMap object to a readable string.

type UsersAndGroups

type UsersAndGroups struct {
	// Users is an entry map of users.
	Users *EntryMap
	// Groups is an entry map of groups.
	Groups *EntryMap
}

UsersAndGroups is a structure that holds entry maps of users and groups. It is returned by AddUsersAndGroups.

func AddUsersAndGroups

func AddUsersAndGroups() (*UsersAndGroups, error)

AddUsersAndGroups is a public wrapper around addUsersAndGroupsImpl with default system file paths.

Jump to

Keyboard shortcuts

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