For the complete documentation index, see llms.txt. This page is also available as Markdown.

ssh

  • TCP 22, OpenSSH is the most common implementation

  • Six authentication methods: password, public-key, host-based, keyboard, challenge-response, GSSAPI

Config

  • Default config: /etc/ssh/sshd_config

cat /etc/ssh/sshd_config | grep -v "#" | sed -r '/^\s*$/d'

Dangerous Settings

Setting
Description

PasswordAuthentication yes

Password auth enabled

PermitEmptyPasswords yes

Empty passwords allowed

PermitRootLogin yes

Root login allowed

Protocol 1

Outdated encryption standard

X11Forwarding yes

GUI forwarding

AllowTcpForwarding yes

Port forwarding

PermitTunnel

Tunneling

DebianBanner yes

Shows specific OS banner

SSH-Audit

git clone https://github.com/jtesta/ssh-audit.git && cd ssh-audit
./ssh-audit.py 10.129.14.132

Change Auth Method

Hostkey Algorithm Fix

  • No matching hostkey error:

  • Append to /etc/ssh/ssh_config:

  • If the error references a different algorithm, substitute accordingly

Forced Command Keys and Legacy SCP

If a recovered private key authenticates but the server closes the shell with a forced command, inspect the matching authorized_keys entry. A restricted key may look like:

scp error message too long

Fix this error with scp legacy mode -O

The -O flag forces the legacy SCP protocol instead of SFTP, which can be needed when the remote wrapper expects scp and otherwise returns:

Last updated