Skip to content

io.systemd.UserDatabase

APIs for querying user and group records.

Property Value
Go package github.com/rossedman/sdvarlink/systemd/latest/userdatabase
Socket /run/systemd/userdb/io.systemd.Multiplexer
Available since systemd v257
Methods · types · errors 3 · 0 · 6

Methods

GetUserRecord

streaming optional

Retrieve one or more user records. Look-up is either keyed by UID or user name, or if neither is specified all known records are enumerated.

func (c *Client) GetUserRecord(ctx context.Context, in GetUserRecordIn) (*GetUserRecordOut, error)
func (c *Client) GetUserRecordMore(ctx context.Context, in GetUserRecordIn) iter.Seq2[*GetUserRecordOut, error]

Parameters

Field Type Description
uid ?int The numeric 32bit UNIX UID of the record, if look-up by UID is desired.
userName ?string The UNIX user name of the record, if look-up by name is desired.
fuzzyNames ?[]string The userdb provider service to search on. Must be set to the base name of the userdb entrypoint socket. This is necessary in order to support services that implement multiple userdb services on the same socket. Names to search for in a fuzzy fashion.
dispositionMask ?[]string User dispositions to limit search by.
uidMin ?int Minimum UID to restrict search too.
uidMax ?int Maximum UID to restrict search too.
service string The userdb provider to search on. Must be set to the name of the userdb entrypoint socket. This is necessary in order to support services that implement multiple userdb services on the same socket.

Reply

Field Type Description
record object The retrieved user record.
incomplete ?bool If set to true, indicates that the user record is not complete, i.e. that the 'privileged' section has been stripped because the client lacks the privileges to access it.

GetGroupRecord

streaming optional

Retrieve one or more group records. Look-up is either keyed by GID or group name, or if neither is specified all known records are enumerated.

func (c *Client) GetGroupRecord(ctx context.Context, in GetGroupRecordIn) (*GetGroupRecordOut, error)
func (c *Client) GetGroupRecordMore(ctx context.Context, in GetGroupRecordIn) iter.Seq2[*GetGroupRecordOut, error]

Parameters

Field Type Description
gid ?int The numeric 32bit UNIX GID of the record, if look-up by GID is desired.
groupName ?string The UNIX group name of the record, if look-up by name is desired.
fuzzyNames ?[]string The userdb provider service to search on. Must be set to the base name of the userdb entrypoint socket. This is necessary in order to support services that implement multiple userdb services on the same socket. Additional names to search for in a fuzzy fashion.
dispositionMask ?[]string Group dispositions to limit search by.
gidMin ?int Minimum GID to restrict search too.
gidMax ?int Maximum GID to restrict search too.
service string The userdb provider to search on. Must be set to the name of the userdb entrypoint socket. This is necessary in order to support services that implement multiple userdb services on the same socket.

Reply

Field Type Description
record object The retrieved group record.
incomplete ?bool If set to true, indicates that the group record is not complete, i.e. that the 'privileged' section has been stripped because the client lacks the privileges to access it.

GetMemberships

streaming optional

Retrieve membership relationships between users and groups.

func (c *Client) GetMemberships(ctx context.Context, in GetMembershipsIn) (*GetMembershipsOut, error)
func (c *Client) GetMembershipsMore(ctx context.Context, in GetMembershipsIn) iter.Seq2[*GetMembershipsOut, error]

Parameters

Field Type Description
userName ?string The UNIX user name of the user to search for memberships for.
groupName ?string The UNIX group name of the group to search for memberships for.
service string The userdb provider to search on. Must be set to the base name of the userdb entrypoint socket. This is necessary in order to support services that implement multiple userdb services on the same socket.

Reply

Field Type Description
userName string The UNIX user name of a discovered membership relationship.
groupName string The UNIX group name of a discovered membership relationship.

Errors

Error Go type Description
NoRecordFound NoRecordFoundError Error indicating that no matching user or group record was found.
BadService BadServiceError Error indicating that the contacted service does not implement the specified service name.
ServiceNotAvailable ServiceNotAvailableError Error indicating that the backing service currently is not operational and no answer can be provided.
ConflictingRecordFound ConflictingRecordFoundError Error indicating that there's a user record matching either UID/GID or the user/group name, but not both at the same time.
NonMatchingRecordFound NonMatchingRecordFoundError Error indicating that there's a user record matching the primary UID/GID or user/group, but that doesn't match the additional specified matches.
EnumerationNotSupported EnumerationNotSupportedError Error indicating that retrieval of user/group records on this service is only supported if either user/group name or UID/GID are specified, but not if nothing is specified.