user

package
v4.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UIDInAnyGroup

func UIDInAnyGroup(uid int, list []string) (bool, error)

UIDInAnyGroup returns true if the user with supplied uid is a member of any group in list. List is a string slice that may contain GIDs, groupnames, or both.

func UIDInList

func UIDInList(uid int, list []string) (bool, error)

UIDInList returns true if the user with supplied uid is in list (match by uid or username). List is a string slice that may contain UIDs, usernames, or both.

Types

type Group

type Group struct {
	Name string
	GID  uint32
}

Group represents a Unix group information.

func GetGrGID

func GetGrGID(gid uint32) (*Group, error)

GetGrGID returns a pointer to Group structure associated with group gid.

func GetGrNam

func GetGrNam(name string) (*Group, error)

GetGrNam returns a pointer to Group structure associated with group name.

type User

type User struct {
	Name  string
	UID   uint32
	GID   uint32
	Gecos string
	Dir   string
	Shell string
}

User represents a Unix user account information.

func Current

func Current() (*User, error)

Current returns a pointer to User structure associated with current user.

func CurrentOriginal

func CurrentOriginal() (*User, error)

CurrentOriginal returns a pointer to User structure associated with the original current user, if current user is inside a user namespace with a custom user mappings, it will returns information about the original user otherwise it returns information about the current user

func GetPwNam

func GetPwNam(name string) (*User, error)

GetPwNam returns a pointer to User structure associated with user name.

func GetPwUID

func GetPwUID(uid uint32) (*User, error)

GetPwUID returns a pointer to User structure associated with user uid.

Jump to

Keyboard shortcuts

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