SSH provides an encrypted connection to a remote Linux host. The server needs OpenSSH Server installed and the sshd service running.

Check the service

sudo systemctl status ssh
sudo ss -tlnp | grep ":22"

Create a key pair

ssh-keygen -t ed25519 -C "feruzbek-laptop"
ssh-copy-id user@192.0.2.10
ssh user@192.0.2.10

Never share your private key. The public key (.pub) is installed in the server user’s authorized_keys file.

Security checklist

  • Do not grant SSH access to unnecessary accounts.
  • Restrict private-key permissions (chmod 600).
  • Limit the SSH port in the firewall to required sources.
  • Before changing PasswordAuthentication, verify key-based access in a second session.

Practice

Create an Ed25519 key in a virtual machine, install the public key on a lab server and test key-based login.