Back to lessons

Cybersecurity Triage

Check Key SSH Authentication Settings

You need to read important SSH daemon authentication settings.

Command

grep -nE '^(PasswordAuthentication|PermitRootLogin|PubkeyAuthentication|AllowUsers)' etc/ssh/sshd_config

What changed

Nothing changes. The command prints matching SSH configuration lines with numbers.

Danger

safe

When to use it

Use during SSH hardening checks or after unexpected login behavior.

When not to use it

Do not reload SSH from this output alone; validate full config syntax in real systems.

Undo or recovery

No undo needed because this command is read-only.

Expected output

Line-numbered SSH authentication settings.

demo script

Disposable terminal steps

  1. sed -n '1,12p' etc/ssh/sshd_config
  2. grep -nE '^(PasswordAuthentication|PermitRootLogin|PubkeyAuthentication|AllowUsers)' etc/ssh/sshd_config

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ sed -n '1,12p' etc/ssh/sshd_config
Port 22
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
AllowUsers alex deploy
::exit-code::0
$ grep -nE '^(PasswordAuthentication|PermitRootLogin|PubkeyAuthentication|AllowUsers)' etc/ssh/sshd_config
2:PermitRootLogin no
3:PasswordAuthentication no
4:PubkeyAuthentication yes
5:AllowUsers alex deploy
::exit-code::0

YouTube Short

Read SSH auth policy.

Pull the key sshd_config authentication lines before changing access rules or restarting SSH.

LinkedIn hook

SSH policy should be visible before you change it.

Question: Do you inspect SSH auth policy before changing sshd_config?

experiments

A/B tests to run

Metric: watch_time

A: Read policy first.

B: Do not edit SSH blind.