Back to lessons

Cybersecurity Triage

List SSH Allow and Deny Rules

You need to find SSH allow-list and deny-list directives across the main config and include files.

Command

grep -RhnE '^(AllowUsers|AllowGroups|DenyUsers|DenyGroups|Match )' etc/ssh

What changed

Nothing changes. The command searches fixture-local SSH config files and prints matching access directives with file and line numbers.

Danger

safe

When to use it

Use during access reviews, server handoffs, or when a user can authenticate but still cannot open an SSH session.

When not to use it

Do not remove allow or deny rules from this output alone; confirm group membership, Match context, and operational ownership first.

Undo or recovery

No undo needed because this command is read-only.

Expected output

Line-numbered SSH access directives from sshd_config and included files.

demo script

Disposable terminal steps

  1. find etc/ssh -type f -print | sort
  2. grep -RhnE '^(AllowUsers|AllowGroups|DenyUsers|DenyGroups|Match )' etc/ssh

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ find etc/ssh -type f -print | sort
etc/ssh/sshd_config
etc/ssh/sshd_config.d/access.conf
::exit-code::0
$ grep -RhnE '^(AllowUsers|AllowGroups|DenyUsers|DenyGroups|Match )' etc/ssh
1:DenyUsers test oldadmin
2:AllowGroups ssh-login deployers
6:AllowUsers alice deploy
8:Match Address 198.51.100.0/24
::exit-code::0

YouTube Short

List SSH access rules.

Search sshd config and includes for allow and deny directives before changing access.

LinkedIn hook

SSH access can be shaped by users, groups, and Match blocks.

Question: Do you search sshd_config includes before changing SSH allow-list rules?

experiments

A/B tests to run

Metric: completion_rate

A: Find allow and deny rules.

B: SSH includes can carry access policy.