Securing Remote Access
Password-based authentication is a major vulnerability. We will enforce Key-based authentication.
Steps:
- Generate a key pair:
ssh-keygen -t ed25519 -C "devsecops-course". - Modify
/etc/ssh/sshd_config:PermitRootLogin noPasswordAuthentication noPort 2222(Change the default port).
- Reload service:
sudo systemctl restart ssh.
Warning: Don't close your current session until you verify the new connection works!