Skip to content

Commit f4cc896

Browse files
ABuljkodaringer
authored andcommitted
Docs: update SSH Authentication (ssh.rst)
1 parent e79c60b commit f4cc896

File tree

1 file changed

+35
-21
lines changed
  • source/components/nitrokeys/features/fido2

1 file changed

+35
-21
lines changed

source/components/nitrokeys/features/fido2/ssh.rst

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,9 @@ SSH Authentication with FIDO2
33

44
.. product-table:: nk3 passkey fido2
55

6-
Use your Nitrokey for secure SSH login to servers, GitLab, or GitHub.
7-
The private key is generated and safely stored inside the device, ensuring it never leaves the hardware.
8-
Authentication requires a physical touch of the Nitrokey, providing strong protection against phishing and unauthorized access.
6+
SSH (Secure Shell) is a network protocol used to securely access and manage remote systems such as servers or code repositories. It uses cryptographic key pairs for authentication, allowing passwordless logins with strong security.
97

10-
What is SSH?
11-
------------
12-
13-
**SSH (Secure Shell)** is a network protocol used to securely access and manage remote systems, such as servers or code repositories.
14-
It uses cryptographic key pairs for authentication, allowing passwordless logins while maintaining strong security.
8+
With a Nitrokey, the private SSH key is generated and stored directly on the device, so it never leaves the hardware. Each login requires you to touch the Nitrokey, adding a simple physical confirmation that protects against unauthorized access. For example, when connecting to a server, GitLab, or GitHub.
159

1610
Generating SSH Key
1711
------------------
@@ -24,8 +18,8 @@ Generating SSH Key
2418
2519
ssh-keygen -t ed25519-sk -C "your_comment"
2620
27-
3. Optionally you can also turn your key into a resident key, allowing it to be used on other computers without copying files. By default, SSH FIDO2 keys created with ``-t ed25519-sk`` are non-resident keys, meaning a local key handle is stored in ``~/.ssh/`` while the private key remains securely on the Nitrokey. Using ``-O resident`` is optional and provides portability across systems. For single-system use, the standard ``ssh-keygen -t ed25519-sk`` command is sufficient.Optionally you can also turn your key into a resident key, allowing it to be used on other computers without copying files. By default, SSH FIDO2 keys created with ``-t ed25519-sk`` are non-resident keys, meaning a local key handle is stored in ``~/.ssh/`` while the private key remains securely on the Nitrokey. Using ``-O resident`` is optional and provides portability across systems. For single-system use, the standard ssh-keygen ``-t ed25519-sk`` command is sufficient.
28-
21+
3. You can optionally create a resident key, allowing it to be used on other computers without copying files. By default, SSH FIDO2 keys created with -t ed25519-sk are non-resident, meaning a local key handle is stored in ~/.ssh/ while the private key remains securely on the Nitrokey. Using -O resident provides portability across systems, but for single-system use, the standard ssh-keygen -t ed25519-sk command is sufficient.
22+
2923
.. code-block:: shell-session
3024
3125
ssh-keygen -t ed25519-sk -O resident -C "your_comment"
@@ -44,9 +38,7 @@ Generating SSH Key
4438

4539
6. If the Nitrokey blinks, confirm the operation by touching it.
4640

47-
7. Optionally you can also set a passphrase (it is usually recommended for security reasons but not mandatory).
48-
49-
8. By executing the command, the following files will be created:
41+
7. By executing the command, the following files will be created:
5042

5143
``~/.ssh/id_ed25519_sk`` → handle to the private key (stored securely on the Nitrokey)
5244

@@ -60,18 +52,40 @@ Generating SSH Key
6052
:alt: img0
6153

6254

63-
Adding your Public Key to GitLab or GitHub
64-
------------------------------------------
65-
1. Enter this command to view your public key in the terminal
55+
Adding Your Public Key
56+
----------------------
6657

67-
.. code-block:: shell-session
58+
Once your SSH key pair is generated, the public key must be added to the service or server you want to access.
59+
60+
**For Git Services (GitLab, GitHub, etc.)**
61+
1. Display your public key:
62+
63+
.. code-block:: shell-session
6864
69-
cat ~/.ssh/id_ed25519_sk.pub
65+
cat ~/.ssh/id_ed25519_sk.pub
7066
7167
Example output (do not use this key)::
7268
73-
[email protected] AAAAGnNrLXNzaC1lZDI1NTE5QG7wZW4zc2guY29tAAAAILeZl6r07HV4i1rK07OfLqD3J4IzX2q0lB6Ok0pdxoG5AAAABHNzaDo= your_comment #. Copy the key to your account...
69+
[email protected] AAAAGnNrLXNzaC1lZDI1NTE5QG7wZW4zc2guY29tAAAAILeZl6r07HV4i1rK07OfLqD3J4IzX2q0lB6Ok0pdxoG5AAAABHNzaDo= your_comment
70+
71+
2. Copy the output and add it to your account’s SSH key settings.
72+
See `GitLab <https://docs.gitlab.com/user/ssh/#add-an-ssh-key-to-your-gitlab-account>` or `GitHub <https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account>` for detailed steps.
73+
74+
75+
**For Remote Servers**
76+
To allow SSH access, the same public key must be listed in the server’s ``~/.ssh/authorized_keys`` file.
77+
During authentication, the server checks for a matching key and verifies your identity through a challenge signed by your Nitrokey’s private key.
78+
79+
To add your key:
80+
81+
.. code-block:: shell-session
7482
75-
2. Add the copied SSH key to your accounts designated SSH Key Field.
83+
mkdir -p ~/.ssh
84+
chmod 700 ~/.ssh
85+
cat ~/.ssh/id_ed25519_sk.pub >> ~/.ssh/authorized_keys
86+
chmod 600 ~/.ssh/authorized_keys
7687
77-
See instructions for `GitLab <https://docs.gitlab.com/user/ssh/#add-an-ssh-key-to-your-gitlab-account>` or `GitHub <https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account>`.
88+
Each line in ``authorized_keys`` represents one trusted key.
89+
90+
You can add multiple keys or restrict usage, for example to a specific IP range and command:
91+
from="192.168.0.*" command="/usr/local/bin/backup.sh" [email protected] AAAAGnNrLXNzaC1lZDI1NTE5QG7wZW4zc2guY29tAAAAILeZl6r07HV4i1rK07OfLqD3J4IzX2q0lB6Ok0pdxoG5AAAABHNzaDo= your_comment

0 commit comments

Comments
 (0)