Skip to content

Setup SSH Keys

To be able to gain remote access to the Skynet.

$USERNAME Refers to your Skynet username, for example I would replace $USERNAME with silver

Windows

If you are using Windows then you should use PowerShell, not cmd.

Prep

First we set up the ssh folder and create a skynet folder within it for neatness

mkdir -p ~/.ssh/skynet
cd ~/.ssh/skynet

Create Key

Now we will create the ssh key itself.

ssh-keygen -t ed25519 -C "<comment>"
  • <comment>: this is a comment to yerself about what the key is for
    • I often use username@host, silver@skynet.
  • Location: ./$USERNAME, your skynet username.
    • ./silver for example.
  • Password: Press Enter twice for no password on the key.

If you are creating this key for a CI/CD pipeline (user_deploy*) then adding a password will cause it to fail.

It will create two files: $USERNAME and $USERNAME.pub inside ~/.ssh/skynet

Linux Only

Openssh will complain if the keys permissions are too permissive.
To fix this use

chmod 600 $USERNAME
# or
chmod 600 ~/.ssh/skynet/$USERNAME

Create Config

Above we created a folder for Skynet keys.
Ye can do the same with Gitlab/Github/... in the future.
The only downside is that we now have to tell ssh what key to use in what situation.

Now we have to create the config file.
Notice how it has no extension.

Create Config

Windows

New-Item ~/.ssh/config -ItemType File -Value ''

Linux

touch ~/.ssh/config

Edit Config

Windows

This uses teh $HOME env var to set the right path for notepad to open.

notepad.exe /W "$HOME/.ssh/config"

Linux

For linux I recommend using Nano

nano ~/.ssh/config
# Basic commands:
# Paste:  [ctrl]+[shift]+[v]
# Save:   [ctrl]+[x], then [y] to accept filename, 
#         then [enter] to save it to disk
You can edit it from command line using nano

Or open up in a GUI text editor.

Windows/Linux

This is what we want to have in the file.
The below is valid currently and suitable for users and admins.

Host *.skynet.ie 193.1.99.* 193.1.96.165
   User $USERNAME
   IdentityFile ~/.ssh/skynet/$USERNAME
   IdentitiesOnly yes
So for me it would be
Host *.skynet.ie 193.1.99.* 193.1.96.165
   User silver
   IdentityFile ~/.ssh/skynet/silver
   IdentitiesOnly yes

Add key to account

The .pub key is what gets shared pubically.
In terminal you can get it by doing

cat ~/.ssh/skynet/$USERNAME.pub
# for example
cat ~/.ssh/skynet/silver.pub

Go to the User details in authentik and paste in the contents of $USERNAME.pub, then click the Save button.

You will now be able to SSH into Skynet like so:

ssh $USERNAME@skynet.skynet.ie
# for example
ssh silver@skynet.skynet.ie