Introduction

An SSH key pair is very useful when you want to give or receive access to a server or computer in a more secure manner. This enables the connecting computer to authenticate itself using a key check (comparison) rather than a password. The key pair is made up of two keys.

  1. The public key (The lock)
    Usually named id_rsa.pub or id_ed25519.pub, where .pub means public. Think of the public key as your lock. To be able to identify with your key (the private key) you need to install your lock on the server you want to connect to. It’s also harmless to share your lock with the world, as long as you keep your key secret

    When you want to be able to authorize using keys then it’s the public key you want to install with the server or send to the people maintaining the server so they can add it for you

  2. The Private key (The key)

    The private key is named the same as your public key, but without .pub. Think of it as the key to your lock (the public key). This should be kept safe and never shared with anyone

With all that out of the way, let us now show you how to create and use an ssh-key pair

NOTE: Instructions are given for all: Linux, MacOS, and Windows

Step 1

Open your Terminal or Windows Terminal/PowerShell

mkdir .ssh; cd .ssh

This is how it will normally look

On Windows, if you see this error, that means you already had the .ssh directory so just move on to the next step

Step 2

Create now the ssh-key pair with

# -- Windows
ssh-keygen -t ed25519 -q -N '""'

and then hit Enter

You can see that you have the private and the public key if you list the directory contents

# -- MacOS and Linux
ssh-keygen -t ed25519 -q -N ""

and then hit Enter

Step 3

You need to copy over the public key (the lock) to your Seedbox by doing

cat id_ed25519.pub

Select and copy over the content of the public key and paste it inside the " " quotation marks

sudo echo "paste your key in here" >> /root/.ssh/authorized_keys

Select and copy the above command (with your public key inside the quotation marks) Then connect via SSH to your seedbox and paste the above.

Note: To be able to write to the .ssh/authorized_keys file, you can use sudo and run the above command with superuser privileges or just switch to root with sudo -i

For example, in my case, this is how it looks like

  • Windows

    echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN1cYVCfVdeUWUaaYYDtv65GPWz1nPlMA7pQFMDSxBjz [email protected]" >> /root/.ssh/authorized_keys
  • Linux/MacOS

    echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMu2bwqqI3nX4Vp64o6pvvKntmZ0+rWNq/I7vIyiI5sL [email protected]" >> /root/.ssh/authorized_keys

Step 4

Now when you connect to your seedbox directly with

ssh [email protected]{Replace-with-SeedboxIP} -p 2222

You're now logging in as the root user and with no password. Easier and safer.

Last step (OPTIONAL)

And because we're not computers, we remember names way easier than numbers. So in order to make the login even easier and smoother, we recommend adding your seedbox IP, username, and port in the ssh config file, giving the seedbox a nickname so that when we call it the system knows to what we're referring

Linux/MacOS

nano ~/.ssh/config

and paste the config options tailored for you

Host [seedbox-nickname] - whatever you'd like to call it
Hostname [Seedbox IP]
User root
Port 2222

Now when you're connecting to your box, you only have to type

ssh [seedbox-nickname]

Windows

On Windows, open a notepad and paste this, edit the Host and add your seedbox IP

Host [seedbox-nickname] - whatever you'd like to call it
Hostname [Seedbox IP]
User root
Port 2222

When saving, select the Save as Type All Files and name the file config

On Windows save the file in C:\Users\[Your PC Username]\.ssh>, where you also placed the ssh-keys

Now when you're connecting to your box, you only have to type

ssh [seedbox-nickname]

Make sure not to save the config file with the .txt extension otherwise you'll get this error

If by chance that does happen, then just rename the confg.txt file to config and that's it

I don't know what to do next...

If you need any assistance, let us know by opening a chat in the bottom-right corner of your screen. We're here to help 😄

Did this answer your question?