2016-09-22 12:43:57 +00:00
---
title: About the group Resource
2018-02-16 00:28:15 +00:00
platform: os
2016-09-22 12:43:57 +00:00
---
# group
2018-10-18 20:48:30 +00:00
Use the `group` InSpec audit resource to test a single group on the system.
2016-09-22 12:43:57 +00:00
2017-10-03 21:35:10 +00:00
<br>
2018-08-09 12:34:49 +00:00
## Availability
### Installation
This resource is distributed along with InSpec itself. You can use it automatically.
### Version
This resource first became available in v1.0.0 of InSpec.
2016-09-27 19:03:23 +00:00
## Syntax
2016-09-22 12:43:57 +00:00
A `group` resource block declares a group, and then the details to be tested, such as if the group is a local group, the group identifier, or if the group exists:
describe group('group_name') do
it { should exist }
its('gid') { should eq 0 }
end
where
2018-10-18 20:48:30 +00:00
* `'group_name'` must specify the name of a group to be tested on the system
2016-09-22 12:43:57 +00:00
* `exist` and `'gid'` are valid matchers for this resource
2017-10-03 21:35:10 +00:00
<br>
2016-09-22 12:43:57 +00:00
2017-10-03 21:35:10 +00:00
## Examples
2016-09-22 12:43:57 +00:00
2017-10-03 21:35:10 +00:00
The following examples show how to use this InSpec audit resource.
2016-09-22 12:43:57 +00:00
2017-10-03 21:35:10 +00:00
### Test the group identifier for the root group
2016-09-22 12:43:57 +00:00
2017-10-03 21:35:10 +00:00
describe group('root') do
it { should exist }
its('gid') { should eq 0 }
end
2016-09-22 12:43:57 +00:00
2017-10-03 21:35:10 +00:00
<br>
2016-09-22 12:43:57 +00:00
2018-10-18 20:48:30 +00:00
## Properties
### gid
The `gid` property tests the named group identifier:
its('gid') { should eq 1234 }
### members
The `members` property tests the members that belong to the group:
its('members') { should include 'root' }
2017-10-03 21:35:10 +00:00
## Matchers
2016-09-22 12:43:57 +00:00
2018-02-16 03:07:18 +00:00
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
2016-09-22 12:43:57 +00:00
2017-10-03 21:35:10 +00:00
### be_local
2016-09-22 12:43:57 +00:00
2017-10-03 21:35:10 +00:00
The `be_local` matcher tests if the group is a local group:
2016-09-22 12:43:57 +00:00
2017-10-03 21:35:10 +00:00
it { should be_local }
2016-09-22 12:43:57 +00:00
2016-09-27 19:03:23 +00:00
### exist
2016-09-22 12:43:57 +00:00
2018-10-18 20:48:30 +00:00
The `exist` matcher tests if the named group exists:
2016-09-22 12:43:57 +00:00
it { should exist }