Table of Contents

Information

Config Files

Main

sudo -e '/etc/ssh/sshd_config'

Custom

/etc/ssh/sshd_config.d

Force Public Key Authentication

echo 'PasswordAuthentication no' | sudo tee '/etc/ssh/sshd_config.d/custom-pubkey-only.conf' > '/dev/null' && cat '/etc/ssh/sshd_config.d/custom-pubkey-only.conf'
sudo -e '/etc/ssh/sshd_config.d/custom-pubkey-only.conf'

Secure Authorized Keys

chmod '400' ~/'.ssh/authorized_keys'

Disable Root Login

echo 'PermitRootLogin no' | sudo tee '/etc/ssh/sshd_config.d/custom-root-login-disable.conf' > '/dev/null' && cat '/etc/ssh/sshd_config.d/custom-root-login-disable.conf'
sudo -e '/etc/ssh/sshd_config.d/custom-root-login-disable.conf'