Skip to content

Secure SSH Access

Using SSH keys instead of passwords protects your server from brute-force attacks.

Configuration

  1. Generate SSH Key Pair (on your local machine)
sh
ssh-keygen -t ed25519 -C "your_email@example.com"

Press Enter to save it in the default location. You can add a passphrase for extra security.

  1. Copy the Public Key to the Server (on your local machine)
sh
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@your-server-ip
  1. Open the SSH configuration (on your server)
sh
sudo nano /etc/ssh/sshd_config

Set these parameters to "no":

yaml
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM no

Save with CTRL + X / Y / Enter

  1. Check the configuration for syntax errors
sh
sudo sshd -t
  1. Restart the SSH service
sh
sudo systemctl restart ssh