You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/components/nitrokeys/features/fido2/ssh.rst
+35-21Lines changed: 35 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,9 @@ SSH Authentication with FIDO2
3
3
4
4
.. product-table:: nk3 passkey fido2
5
5
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.
9
7
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.
15
9
16
10
Generating SSH Key
17
11
------------------
@@ -24,8 +18,8 @@ Generating SSH Key
24
18
25
19
ssh-keygen -t ed25519-sk -C "your_comment"
26
20
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 residentprovides portability across systems, but for single-system use, the standard ssh-keygen -t ed25519-sk command is sufficient.
6. If the Nitrokey blinks, confirm the operation by touching it.
46
40
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:
50
42
51
43
``~/.ssh/id_ed25519_sk`` → handle to the private key (stored securely on the Nitrokey)
52
44
@@ -60,18 +52,40 @@ Generating SSH Key
60
52
:alt:img0
61
53
62
54
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
+
----------------------
66
57
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
68
64
69
-
cat ~/.ssh/id_ed25519_sk.pub
65
+
cat ~/.ssh/id_ed25519_sk.pub
70
66
71
67
Example output (do not use this key)::
72
68
73
-
[email protected] AAAAGnNrLXNzaC1lZDI1NTE5QG7wZW4zc2guY29tAAAAILeZl6r07HV4i1rK07OfLqD3J4IzX2q0lB6Ok0pdxoG5AAAABHNzaDo= your_comment #. Copy the key to your account...
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
74
82
75
-
2. Add the copied SSH key to your accounts designated SSH Key Field.
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:
0 commit comments