SSH-Key Based Authentication on a Linux Server

Linux Feb 6, 2021
  1. Generate an SSH Key Pair

Windows/Linux: ssh-keygen
It's recomended to set a password as this will encrypt the Private Key.

  1. Place the Public Key on the Linux Server

Paste the contents on the Public Key into the authorized_keys file.

sudo nano ${HOME}/.ssh/authorized_keys

  1. Restart SSH
    sudo service sshd restart

Connect via SSH

Terminal: $ sudo ssh -i path-to-private-key username@remote-server-ip

Termius Docs
Putty (Ionos Tutorial)

Disable Password Authentication

sudo nano /etc/ssh/sshd_config

Uncomment PasswordAuthentication yes

Then set value to no PasswordAuthentication no

Restart SSH sudo service sshd restart

Tags

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.