idutils

package
v0.7.1-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: Apache-2.0 Imports: 10 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupGid

func LookupGid(grp, rootfs string) (gid uint, err error)

Looks up a gid by a given name in the rootfs' /etc/group

func LookupGidsByUser

func LookupGidsByUser(name string, rootfs string) (gids []uint, err error)

TODO: maybe also read the user's groups and put them into the spec process's AdditionalGroups? (but then read /etc/groups only once!)

... or delete this method with its gidsByUserLookup

Looks up all associated gids by a given username in the given rootfs' /etc/groups

Types

type IdMappings

type IdMappings interface {
	UidToHost(int) (int, error)
	GidToHost(int) (int, error)
	UidToContainer(int) (int, error)
	GidToContainer(int) (int, error)
}
var (
	MapIdentity IdMappings = idIdentity("identity")
	MapRootless            = NewIdMappings([]specs.LinuxIDMapping{{uint32(os.Geteuid()), 0, 1}}, []specs.LinuxIDMapping{{uint32(os.Getegid()), 0, 1}})
)

func NewIdMappings

func NewIdMappings(uidMappings, gidMappings []specs.LinuxIDMapping) IdMappings

type User

type User struct {
	User  string
	Group string
}

func ParseUser

func ParseUser(v string) (r User)

func (User) Resolve

func (u User) Resolve(rootfs string) (r UserIds, err error)

func (User) String

func (u User) String() string

func (User) ToIds

func (u User) ToIds() (r UserIds, err error)

type UserIds

type UserIds struct {
	Uid uint
	Gid uint
}

func LookupUser

func LookupUser(usr string, rootfs string) (r UserIds, err error)

Looks up a user by uid or name in the rootfs' /etc/passwd

func (UserIds) IsZero

func (u UserIds) IsZero() bool

func (*UserIds) String

func (u *UserIds) String() string

func (*UserIds) ToContainer

func (u *UserIds) ToContainer(m IdMappings) (r UserIds, err error)

func (*UserIds) ToHost

func (u *UserIds) ToHost(m IdMappings) (r UserIds, err error)

func (UserIds) User

func (u UserIds) User() User

Jump to

Keyboard shortcuts

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