Debian GNU/Linux · Network

Limit SSH logins to the users and groups that need them

When it fails: Every account with a valid credential can log in over SSH. Service accounts, temporary users or accounts with a leaked key can open a shell remotely although they never should.

CB-DEB-NET-021mediumactivemanualprofile core

As released in v0.1.1 beta · pre-release. Current state.

Description

The OpenSSH server options AllowGroups, AllowUsers, DenyGroups and DenyUsers restrict which accounts may log in, whatever credentials they hold. A typical setup allows one group, for example AllowGroups ssh-users, and adds the people who administer or use the host to it.

Rationale

Many accounts exist on a system for services, applications or past projects. An allow list makes SSH access a deliberate decision per account, so that a key or password left on an account that should not log in remotely is useless to an attacker.

Impact

Accounts outside the list, including automation accounts, cannot log in anymore. The list must be kept up to date with arrivals and departures. The right list depends on the host, which is why there is no automatic fix.

Applies when

Detected: when: OpenSSH server is installed A scanner reports the control not applicable when one is false.

Audit

Run sshd -T | grep -E '^(allowusers|allowgroups|denyusers|denygroups) '. At least one of these options must be set, and the accounts or groups it allows must match the list of people and tools that need SSH access to this host.

Remediation

  1. Create a group (groupadd ssh-users) and add the accounts that need SSH access (usermod -aG ssh-users <account>), starting with your own.
  2. Add AllowGroups ssh-users to /etc/ssh/sshd_config.d/00-cirsec.conf.
  3. Check with sshd -t, run systemctl reload ssh, and test a new connection before closing the current one.

Rollback

Remove the AllowGroups line and run systemctl reload ssh.

References

Mappings

FrameworkIDRelation
NIST SP 800-53 Rev. 55.1.1AC-17partial
NIST SP 800-53 Rev. 55.1.1AC-3related

How this control relates to the other framework's: equivalent, stricter, looser, partial or related.

Threats mitigated

People and lifecycle

Authors
Introduced inv0.1.0
Created, updated2026-10-18, 2026-10-18
Translationsfr