Skip to content

Commit

Permalink
Update ssh.md
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmwyant authored Sep 1, 2023
1 parent 3a5212d commit 466dbb6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/ssh.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Use `ssh-keygen` to generate a pair of keys. The name of the private key file i

### On Windows

There is an unfortunate quirk with `ssh-keygen` on Windows. Trivial once it's understood, it was a significant barrier for me when first attempting to use SSH and one of the reasons I would suggest using WSL2. The snippet below shows the beginning of the process. The 3rd line is the kicker, the wording used makes it clear that it's asking for a file but the input needs to be an (existing) folder, not a file. This input is optional, if you don't specify a directory, the key pair is C:\Users\me\.ssh\id_rsa and C:\Users\me\.ssh\id_rsa.pub. The actual behavior conflicts with the last part of the prompt (C:\Users\me/.ssh/id_rsa), which sets the expectation that you need to specify the path to a *file*, which is indeed the case on Linux.
There is an unfortunate quirk with `ssh-keygen` on Windows. Trivial once it's understood, it was a significant barrier for me when first attempting to use SSH and one of the reasons I would suggest using WSL2. The snippet below shows the beginning of the process. The 3rd line is the kicker, the wording used makes it clear that it's asking for a file but to a Windows user it might look like it's asking for a folder because there is no file extension. It is indeed asking for the name of a file, the private key file is extension-less. This input is optional, if you don't specify a directory, the key pair is `C:\Users\me\.ssh\id_rsa` and `C:\Users\me\.ssh\id_rsa.pub`. The actual behavior conflicts with the last part of the prompt (C:\Users\me/.ssh/id_rsa), which sets the expectation that you need to specify the path to a *file*, which is indeed the case on Linux.

The seperators used in the prompt are also decidedly sloppy. You have to recognize that the default private key file in Linux is `~/.ssh/id_rsa` and that the Windows equivalent to the Linux homepath, `~`, is `%USERPROFILE%`. Considering this OS translation you can see that the default file path shown in the prompt is supposed to be `{whatever the OS considers HOME}/.ssh/id_rsa` but the path seperators used in the prompt must be hard-coded, as they do not change with the environment.

Expand Down

0 comments on commit 466dbb6

Please sign in to comment.