# /etc/ssh/sshd_config.d/10-hardening.conf (lesson OPS-250-L03) # On Ubuntu the main sshd_config includes sshd_config.d/*.conf first, and for most keywords the FIRST value # read wins, so this snippet overrides the defaults below it. Before using it: # 1. log in with your SSH key (not a password) in one terminal and KEEP THAT SESSION OPEN; # 2. sudo sshd -t (no output = valid); 3. sudo systemctl restart ssh.service; # 4. open a SECOND terminal and log in again before closing the first. PubkeyAuthentication yes PasswordAuthentication no KbdInteractiveAuthentication no PermitRootLogin no # Only these accounts may log in over SSH (replace "deploy" with your admin user name): AllowUsers deploy