osuser

package
v1.66.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: BSD-3-Clause Imports: 11 Imported by: 2

Documentation

Overview

Package osuser implements OS user lookup. It's a wrapper around os/user that works on non-cgo builds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGroupIds added in v1.66.0

func GetGroupIds(user *user.User) ([]string, error)

GetGroupIds returns the list of group IDs that the user is a member of, or an error. It will first try to use the 'id' command to get the group IDs, and if that fails, it will fall back to the user.GroupIds method.

func LookupByUID

func LookupByUID(uid string) (*user.User, error)

LookupByUID is like os/user.LookupId but handles a few edge cases like gokrazy and non-cgo lookups.

func LookupByUIDWithShell

func LookupByUIDWithShell(uid string) (u *user.User, shell string, err error)

LookupByUIDWithShell is like os/user.LookupId but handles a few edge cases like gokrazy and non-cgo lookups, and returns the user shell. The user shell lookup is best-effort and may be empty.

func LookupByUsername

func LookupByUsername(username string) (*user.User, error)

LookupByUsername is like os/user.Lookup but handles a few edge cases like gokrazy and non-cgo lookups.

func LookupByUsernameWithShell

func LookupByUsernameWithShell(username string) (u *user.User, shell string, err error)

LookupByUsernameWithShell is like os/user.Lookup but handles a few edge cases like gokrazy and non-cgo lookups, and returns the user shell. The user shell lookup is best-effort and may be empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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