Skip to content

Commit c6bb52c

Browse files
feat(linux-ssh): add the answer for linux ssh-keygen question (bregman-arie#211)
1 parent 53e6b6f commit c6bb52c

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,62 @@ It means that the key of the remote host was changed and doesn't match the one t
11621162

11631163
<details>
11641164
<summary>What <code>ssh-keygen</code> is used for?</summary><br><b>
1165+
1166+
<code>ssh-keygen</code> is a tool to generate an authentication key pair for SSH, that consists of a private and a public key. It supports a number of algorithms to generate authentication keys :
1167+
- dsa
1168+
- ecdsa
1169+
- ecdsa-sk
1170+
- ed25519
1171+
- ed25519-sk
1172+
- rsa (default)
1173+
1174+
One can also specify number of bits in key. Command below generates an SSH key pair with RSA 4096-bits :
1175+
```
1176+
$ ssh-keygen -t rsa -b 4096
1177+
```
1178+
1179+
The output looks like this:
1180+
```
1181+
Generating public/private rsa key pair.
1182+
Enter file in which to save the key (/home/user/.ssh/id_rsa):
1183+
Enter passphrase (empty for no passphrase):
1184+
Enter same passphrase again:
1185+
Your identification has been saved in /home/user/.ssh/id_rsa
1186+
Your public key has been saved in /home/user/.ssh/id_rsa.pub
1187+
The key fingerprint is:
1188+
SHA256:f5MOGnhzYfC0ZCHvbSXXiRiNVYETjxpHcXD5xSojx+M user@mac-book-pro
1189+
The key's randomart image is:
1190+
+---[RSA 4096]----+
1191+
| . ..+***o|
1192+
| o o++*o+|
1193+
| . =+.++++|
1194+
| B.oX+. .|
1195+
| S *=o+ |
1196+
| . o oE. |
1197+
| . + + + |
1198+
| . = + . |
1199+
| . . |
1200+
+----[SHA256]-----+
1201+
```
1202+
1203+
One can check how many bits an SSH key has with :
1204+
```
1205+
$ ssh-keygen -l -f /home/user/.ssh/id_rsa
1206+
```
1207+
1208+
Output should look like this :
1209+
```
1210+
4096 SHA256:f5MOGnhzYfC0ZCHvbSXXiRiNVYETjxpHcXD5xSojx+M user@mac-book-pro (RSA)
1211+
```
1212+
It shows the key is RSA 4096-bits.
1213+
1214+
`-l` and `-f` parameters usage explanation :
1215+
```
1216+
-l Show the fingerprint of the key file.
1217+
-f filename Filename of the key file.
1218+
```
1219+
1220+
Learn more : [How can I tell how many bits my ssh key is? - Superuser](https://superuser.com/a/139311)
11651221
</b></details>
11661222

11671223
<details>

0 commit comments

Comments
 (0)