Table of Contents
getusers
Table of Contents
Prototype: getusers(exclude_names, exclude_ids)
Return type: slist
Description: Returns a list of all users defined, except those names in exclude_names
and uids in exclude_ids
Arguments:
Example:
body common control
{
bundlesequence => { "example" };
}
bundle agent example
{
vars:
"allusers" slist => getusers("","");
"root_list" slist => { "root" };
# this will get just the root users out of the full user list
"justroot" slist => intersection(allusers, root_list);
reports:
"Found just the root user: $(justroot)";
}
Output:
R: Found just the root user: root
Notes:
- This function is currently only available on Unix-like systems.
- This function will return both local and remote (for example, users defined in an external directory like LDAP) users on a system.
History:
- Introduced in CFEngine 3.1.0b1, CFEngine Nova/Enterprise 2.0.0b1 (2010).
See also: getuserinfo()
, users
.