user

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

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