tailscale.comtailscale.com/util/osuser Index | Files

package osuser

import "tailscale.com/util/osuser"

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

Index

Functions

func GetGroupIds

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.

Source Files

group_ids.go user.go

Version
v1.84.0 (latest)
Published
May 21, 2025
Platform
linux/amd64
Imports
11 packages
Last checked
1 day ago

Tools for package owners.