
If you experience any problems after following along in this tutorial, leave a comment below and I will assist you.
Once I create a video I will embed it here.
This tutorial will show you how to generate ed25519 key, upload it to your server and use it to ssh into your server.
All the following processes should be done on the local computer, not on the server you want to set up SSH for.
Generate SSH Key
The following will create a folder named, keysfolder for storing your Keys and generate a keypair named myserverkey . You may change the folder and key names to anything.
You should name your keys in a way that you can easily identify them. A key for a DigitalOcean Ubuntu server could be called, DigitalOCeanUbuntu22
.
In Mac/Linux Terminal or Git Bash for Windows, on your local PC run the following:
mkdir -p ~/.ssh/keysfolder/ && ssh-keygen -t ed25519 -f ~/.ssh/keysfolder/myserverkey
The first part creates the folder, the second part after the ‘&&
‘ generates the keypair.
Give the key a passphrase if you want to protect it with a password. You will need to enter the key passphrase when you log into your server.
Upload SSH key to server
The format for uploading your key is:
ssh-copy-id -i ~/path-to-public-key user@host
You are uploading the public key which ends in .pub
For instance:
ssh-copy-id -i ~/.ssh/keysfolder/myserverkey.pub [email protected]
If you have changed ssh port from port 22 you can define the port as follows:
ssh-copy-id -i ~/.ssh/keysfolder/myserverkey.pub -p 9000 [email protected]
Log in via SSH Key private ed25519 key
To log in, the format is as follows:
ssh user@server_ip -i ~/.ssh/path-to-private-key
Remember to log in with the private key which does not have the .pub
extension.
Example :
ssh [email protected] -i ~/.ssh/keysfolder/myserverkey
If you have changed your SSH port from port 22, do:
ssh [email protected] -i ~/.ssh/keysfolder/myserverkey -p9000
Remember to log in with the private key which does not have the .pub
extension.
That’s how to generate an ED25519 SSH key and use it to log into your Linux server.