Documentation ¶
Overview ¶
Package osuser implements OS user lookup. It's a wrapper around os/user that works on non-cgo builds.
Index ¶
- func GetGroupIds(user *user.User) ([]string, error)
- func LookupByUID(uid string) (*user.User, error)
- func LookupByUIDWithShell(uid string) (u *user.User, shell string, err error)
- func LookupByUsername(username string) (*user.User, error)
- func LookupByUsernameWithShell(username string) (u *user.User, shell string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGroupIds ¶ added in v1.66.0
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 ¶
LookupByUID is like os/user.LookupId but handles a few edge cases like gokrazy and non-cgo lookups.
func LookupByUIDWithShell ¶
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 ¶
LookupByUsername is like os/user.Lookup but handles a few edge cases like gokrazy and non-cgo lookups.
func LookupByUsernameWithShell ¶
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.