github.com/inspektor-gadget/inspektor-gadget@v0.28.1/docs/devel/operator/UidGidResolver.md (about) 1 --- 2 title: UidGidResolver 3 weight: 100 4 description: > 5 Resolving UID and GID to username and groupname 6 --- 7 8 # UidGidResolver 9 10 The `UidGidResolver` resolves user ids and group ids to their corresponding names. 11 12 This is done by reading `/etc/passwd` and `/etc/group` on the host. 13 Therefore any `UID` inside a container might not properly match the username inside the container. 14 Since the path is hardcoded usernames provided through `ldap`, `nss-systemd`, systemd units with `DynamicUser=yes`, ... will not be resolved correctly. 15 16 ## Usage 17 18 ### Classic gadgets 19 20 1. Implement the UidResolverInterface for the `event struct` to resolve a UID. 21 The `UID` which is returned by `GetUid()` will be resolved to the corresponding username and is passed into `SetUserName(...)` 22 ```go 23 type UidResolverInterface interface { 24 GetUid() uint32 25 SetUserName(string) 26 } 27 ``` 28 2. Implement the GidResolverInterface for the `event struct` to a resolve GID. 29 The `GID` which is returned by `GetGid()` will be resolved to the corresponding groupname and is passed into `SetGroupName(...)` 30 ```go 31 type GidResolverInterface interface { 32 GetGid() uint32 33 SetGroupName(string) 34 } 35 ``` 36 37 ### Image based gadgets 38 39 TODO