findlocalusers
Table of contents
Prototype: findlocalusers(filter)
Return type: data
Description: Returns a data container of all local users with their attributes that are matching a filter. If no filter is specified, it will return all the local users.
Arguments:
filter
:string
- Filter list - in the range:.*
The filter
argument can be used to look up users with specific attributes that match values. The filter is a "data"
container or "slist"
comprised of pairs of attribute and value/regex pattern { "attribute1=value1", "attribute2=value2", ... }
.
The possible attributes are:
* name
: name
* uid
: user id
* gid
: group id
* gecos
: description
* dir
: path to home directory
* shell
: default shell
Example:
code
body common control
{
bundlesequence => { "example" };
}
bundle agent example
{
vars:
"root_filter" slist => {"gid=0", "name=root"};
"root_container" data => findlocalusers("@(root_filter)");
"root_list" slist => getindices("root_container");
"bin_filter" data => '["name=bin"]';
"bin_container" data => findlocalusers("@(bin_filter)");
"bin_list" slist => getindices("bin_container");
reports:
"List: $(root_list)";
"List: $(bin_list)";
}
Output:
code
R: List: root
R: List: bin
Notes:
- This function is currently only available on Unix-like systems.
History:
- Function added in 3.26.0.