Hero Image

Server Setup Guides

Harden SSH on AlmaLinux 9

Harden SSH on AlmaLinux 9

Back up config

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak

Key settings (/etc/ssh/sshd_config)

Port 2222
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
AllowUsers deploy alice
Protocol 2
ClientAliveInterval 600
ClientAliveCountMax 0
X11...
7th May 2026

Harden SSH on Arch Linux

Harden SSH on Arch Linux

Back up config

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak

Key settings (/etc/ssh/sshd_config)

Port 2222
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
AllowUsers deploy alice
Protocol 2
ClientAliveInterval 600
ClientAliveCountMax 0
X11F...
7th May 2026

Harden SSH on Debian 12

Harden SSH on Debian 12

Back up config

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak

Key settings (/etc/ssh/sshd_config)

Port 2222
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
AllowUsers deploy alice
Protocol 2
ClientAliveInterval 600
ClientAliveCountMax 0
X11Fo...
7th May 2026

Harden SSH on Gentoo Linux

Harden SSH on Gentoo Linux

Back up config

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak

Key settings (/etc/ssh/sshd_config)

Port 2222
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
AllowUsers deploy alice
Protocol 2
ClientAliveInterval 600
ClientAliveCountMax 0
X1...
7th May 2026

Harden SSH on NetBSD 10

Harden SSH on NetBSD 10

Back up config

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak

Key settings (/etc/ssh/sshd_config)

Port 2222
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
AllowUsers deploy alice
Protocol 2
ClientAliveInterval 600
ClientAliveCountMax 0
X11Fo...
7th May 2026

Harden SSH on OpenBSD 7.5

Harden SSH on OpenBSD 7.5

Back up config

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak

Key settings (/etc/ssh/sshd_config)

Port 2222
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
AllowUsers deploy alice
Protocol 2
ClientAliveInterval 600
ClientAliveCountMax 0
X11...
7th May 2026

Harden SSH on RHEL 9

Harden SSH on RHEL 9

Back up config

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak

Key settings (/etc/ssh/sshd_config)

Port 2222
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
AllowUsers deploy alice
Protocol 2
ClientAliveInterval 600
ClientAliveCountMax 0
X11Forwa...
7th May 2026

Harden SSH on Ubuntu 24.04

Harden SSH on Ubuntu 24.04

Back up config

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak

Key settings (/etc/ssh/sshd_config)

Port 2222
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
AllowUsers deploy alice
Protocol 2
ClientAliveInterval 600
ClientAliveCountMax 0
X1...
7th May 2026

SSH security best practice

SSH Security Best Practices

At file /etc/ssh/sshd_config:

Disable Root Logins

Best: PermitRootLogin no
Good: PermitRootLogin without-password

wihout-password requires "PubkeyAuthentication yes"

Limit user Logins

AllowUsers somusername1 someusername2

Disable Protocol 1

Protocol 2

U

...
14th Mar 2019

SSH TOTP MFA on AlmaLinux 9

SSH TOTP MFA on AlmaLinux 9

Step 1 – Install PAM module

dnf install -y google-authenticator-libpam

Step 2 – Configure for each user

google-authenticator
# time-based: y, update file: y, disallow reuse: y, rate limit: y

Scan QR code with an authenticator app (Aegis, Google Authenticator, et...

7th May 2026

SSH TOTP MFA on Arch Linux

SSH TOTP MFA on Arch Linux

Step 1 – Install PAM module

pacman -S --noconfirm libpam-google-authenticator

Step 2 – Configure for each user

google-authenticator
# time-based: y, update file: y, disallow reuse: y, rate limit: y

Scan QR code with an authenticator app (Aegis, Google Authenticat...

7th May 2026

SSH TOTP MFA on Debian 12

SSH TOTP MFA on Debian 12

Step 1 – Install PAM module

apt install -y libpam-google-authenticator

Step 2 – Configure for each user

google-authenticator
# time-based: y, update file: y, disallow reuse: y, rate limit: y

Scan QR code with an authenticator app (Aegis, Google Authenticator, etc....

7th May 2026

SSH TOTP MFA on Gentoo Linux

SSH TOTP MFA on Gentoo Linux

Step 1 – Install PAM module

emerge --ask sys-auth/google-authenticator-libpam

Step 2 – Configure for each user

google-authenticator
# time-based: y, update file: y, disallow reuse: y, rate limit: y

Scan QR code with an authenticator app (Aegis, Google Authentic...

7th May 2026

SSH TOTP MFA on NetBSD 10

SSH TOTP MFA on NetBSD 10

Step 1 – Install PAM module

# Install google-authenticator for NetBSD 10

Step 2 – Configure for each user

google-authenticator
# time-based: y, update file: y, disallow reuse: y, rate limit: y

Scan QR code with an authenticator app (Aegis, Google Authenticator, et...

7th May 2026

SSH TOTP MFA on OpenBSD 7.5

SSH TOTP MFA on OpenBSD 7.5

Step 1 – Install PAM module

# Install google-authenticator for OpenBSD 7.5

Step 2 – Configure for each user

google-authenticator
# time-based: y, update file: y, disallow reuse: y, rate limit: y

Scan QR code with an authenticator app (Aegis, Google Authenticator...

7th May 2026

SSH TOTP MFA on RHEL 9

SSH TOTP MFA on RHEL 9

Step 1 – Install PAM module

dnf install -y google-authenticator-libpam

Step 2 – Configure for each user

google-authenticator
# time-based: y, update file: y, disallow reuse: y, rate limit: y

Scan QR code with an authenticator app (Aegis, Google Authenticator, etc.).

...
7th May 2026