Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( UsersFile string = "/etc/passwd" GroupsFile string = "/etc/group" )
Functions ¶
func MustHome ¶
func MustHome() string
MustHome returns running users home, if found/exists or not.
- Get home from system data.
- Get home from environment variable.
- Set home from resolved UID → USERNAME to /home/USERNAME.
- Get user from environment variable and assume /home/USERNAME.
- Fallback to /home/UID.
func UUID ¶
UUID provides a simple reproducable pseudo system-UUID for that running system. Just like product_serial or similar to identify the system.
This seems as reliant as product_serial's since operating systems can move anywhere now from physical to virtual hardware and back.
This UUID consists of the following UTS bytes:
Nodename - Usually only set once for a VM. Machine - Archtecture like x86_64 or arm64. (immutable) Sysname - VM's usually get a new deployment on reinstall. (Linux/FreeBSD/...)
These bytes get hashed by xxhash3. The returned 16 bytes have special values of "e" at postions 6,8,10 to identify as pseudo system-uuid.
Example: ec9692b4-a3c5-eeb7-eeb1-eeca85334893
UUID() will return a Nil value 00000000-0000-0000-0000-000000000000 if an error occured. You can check the result with uuid.IsNil().
Types ¶
type Group ¶
func GroupByName ¶
GroupByName returns the group parameters of the given name and a found boolean value.