Update some ssh key stuff to be less obtuse

This commit is contained in:
emholt1 2026-03-11 15:47:23 +01:00
parent ba0e887b89
commit 4dddeb9f58

View file

@ -5,7 +5,7 @@ eleventyNavigation:
parent: Security
order: 20
---
Opposed to using HTTPS, SSH keys provide a safer and passwordless way to authenticate with Codeberg.
It is recommended to use one key per client. This means that if you access your Codeberg repository from your home PC,
your laptop and your office PC you should generate separate keys for each machine.
@ -21,12 +21,13 @@ your laptop and your office PC you should generate separate keys for each machin
This will generate a new SSH key.
You can also add a comment to help you identify the client with `-C "comment here"`.
The program will also ask for a name and email address to associate with the key. While it is reccomended to fill in something identifiable here, if you don't wish to, it may safely be left blank. These fields are for organizational purposes.
```shell
> Generating public/private ed25519 key pair.
```
3. When you're prompted to "Enter a file in which to save the key", press <kbd>Enter</kbd>.
4. When you're prompted to "Enter a file in which to save the key", press <kbd>Enter</kbd>.
This accepts the default file location:
```shell
@ -36,16 +37,10 @@ your laptop and your office PC you should generate separate keys for each machin
If you see that `/home/knut/.ssh/id_ed25519 already exists`, follow these steps:
1. When prompted to overwrite the existing file, type <kbd>n</kbd> to choose not to overwrite.
2. Afterward, re-run the same command:
```shell
ssh-keygen -t ed25519 -a 100
```
3. This time, enter a new filepath when prompted (e.g., `/home/knut/.ssh/id_ed25519_codeberg`) to avoid overwriting the
2. Afterward, re-run the same command. This time, enter a new filepath when prompted (e.g., `/home/knut/.ssh/id_ed25519_codeberg`) to avoid overwriting the
existing key.
4. You will be asked for a passphrase; enter one if you'd like, or leave the prompt empty.
5. You will be asked for a passphrase; enter one if you'd like, or leave the prompt empty.
Your private key can be protected by a passphrase. This adds a layer of authentication that increases security.
Be aware that this will only be helpful for certain attack scenarios and does not offer 100% protection.
@ -76,8 +71,9 @@ be prompted to touch it to continue.
1. Copy the SSH key to your clipboard. You must only copy the public key not the private one.
You can identify it by the `.pub` suffix. By default, you can find the public key in `$HOME/.ssh/id_ed25519.pub`.
On Linux, assuming you are using Wayland, you can use `wl-copy` on the command line.
You may need to install `wl-clipboard` from your package manager.
The key can be opened with any text editor and copied from there. However, there are other ways to copy the key from the terminal.
On Linux with Wayland, use the `wl-copy` utility. (This may require an installation of the `wl-clipboard` package):
```shell
wl-copy -t text/plain < ~/.ssh/id_ed25519.pub
@ -103,10 +99,7 @@ be prompted to touch it to continue.
These commands will copy the contents of id_ed25519.pub (your SSH public key) to your clipboard.
> Alternatively you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to
> your clipboard.
2. Navigate to your [user settings](https://codeberg.org/user/settings)
2. Navigate to your [user settings.](https://codeberg.org/user/settings)
<img src="/images/security/user-settings.png" alt="User Settings">
@ -240,7 +233,7 @@ ssh-add # enter your passphrase once, then it is cached.
```bash
git remote -v
```test
```
The output should look like this: