2024-09-22 19:09:29 +01:00
|
|
|
# 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``
|
|
|
|
|
2025-02-13 17:58:56 +00:00
|
|
|
## Windows
|
|
|
|
If you are using Windows then you should use PowerShell, not ``cmd``.
|
|
|
|
|
2025-02-09 21:21:32 +00:00
|
|
|
## Prep
|
2024-09-22 19:09:29 +01:00
|
|
|
First we set up the ssh folder and create a skynet folder within it for neatness
|
|
|
|
|
|
|
|
```bash
|
|
|
|
mkdir -f -p ~/.ssh/skynet
|
|
|
|
cd ~/.ssh/skynet
|
|
|
|
```
|
|
|
|
|
2025-02-09 21:21:32 +00:00
|
|
|
## Create Key
|
2025-02-13 17:58:56 +00:00
|
|
|
Now we will create the ssh key itself.
|
2024-09-22 19:09:29 +01:00
|
|
|
|
|
|
|
```bash
|
|
|
|
ssh-keygen -t ed25519 -C "<comment>"
|
|
|
|
```
|
2025-02-13 17:58:56 +00:00
|
|
|
|
|
|
|
* ``<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.
|
|
|
|
|
|
|
|
|
2024-09-22 19:09:29 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
```bash
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
Back up to the ``.ssh`` folder.
|
|
|
|
```bash
|
|
|
|
cd ../
|
|
|
|
# or
|
|
|
|
cd ~/.ssh
|
|
|
|
```
|
|
|
|
|
|
|
|
Now we have to create the config file.
|
|
|
|
Notice how it has no extension.
|
|
|
|
|
|
|
|
|
|
|
|
### Windows
|
|
|
|
```powershell
|
|
|
|
"" > config
|
|
|
|
```
|
|
|
|
Open it up in any text editor available to you.
|
|
|
|
|
|
|
|
### Linux
|
|
|
|
```bash
|
|
|
|
touch config
|
|
|
|
```
|
|
|
|
You can edit it from command line using nano
|
|
|
|
|
|
|
|
```bash
|
|
|
|
nano config
|
|
|
|
```
|
|
|
|
Or open up in a text editor.
|
|
|
|
|
|
|
|
### Windows/Linux
|
|
|
|
This is what we want to have in teh file.
|
|
|
|
```
|
|
|
|
Host *.skynet.ie
|
|
|
|
User $USERNAME
|
|
|
|
IdentityFile ~/.ssh/skynet/$USERNAME
|
|
|
|
IdentitiesOnly yes
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Add key to account
|
|
|
|
Go to [the modify SSH page](https://account.skynet.ie/modify_ssh) and paste in teh contents of ``$USERNAME.pub``.
|
|
|
|
|
|
|
|
You will now be able to SSH into Skynet like so:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
ssh $USERNAME@skynet.skynet.ie
|
|
|
|
```
|