SSH keys using windows

I was able to generate ssh key using the following command in windows 11

ssh-keygen

and presumably, it was saved in the location

(C:\Users\admin/.ssh/id_rsa):

but I can't find any key at that location.

C:\Users\admin>ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\admin/.ssh/id_rsa): ssh-wrt
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in ssh-wrt.
Your public key has been saved in ssh-wrt.pub.

I did try with puttygen.exe too, but face this error when using that key

1 Like

What happens when you go to this folder instead of the one where you have hidden the path?

the hidden folder is this folder, I just changed the name which I have hidden to admin.
I can't find the sub folder /id_rsa in .ssh folder only those two files. I do have hidden files disabled i.e all files are visible both hidden and normal.

same situation with ubuntu running in WSL-2

image

Generating public/private rsa key pair.
Enter file in which to save the key (/home/admin/.ssh/id_rsa): uopenwrt
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in uopenwrt
Your public key has been saved in uopenwrt.pub
The key fingerprint is:

Did you export the putty key as openssl format?

What actual Windows 11 version do we talk about?

I am impressed that you actually trust Microsoft and the Windows core do your SSL keys without knowing how they actually do it.

At least I would install OpenSSL and do the keys with some control.

How to install OpenSSL?
The putty issue was resolved by this post

login as: root
Authenticating with public key "rsa-key-20220711"


BusyBox v1.33.2 (2022-04-16 12:59:34 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 21.02.3, r16554-1d4dea6d4f
 -----------------------------------------------------
root@OpenWrt:~#

image
Login without password

I want similar access from win 11's ssh and also from ubuntu's SSH.
image

The thing with Windows Home in any version is that you usually can’t do system related work in pretty much any way.

Problems creating the keys under Windows 11 is off topic.
Since you managed to create them with Putty, you can use them in Windows.
If you still insist on creating the keys in Windows, it would be better to ask in Windows related forums.

3 Likes

The thing is that you don’t need to do a SSL key with every system you want to use. You have one high quality crypto system running for example OpenSSL to make all the keys and then distribute them to the systems that are supposed to use them.

1 Like

From a security perspective, the private ssh keys should never leave the system they've been generated on (aside from rather specific use case, like offline backup or using a high-entropy system to generate keys for low-entropy ones). Sharing ssh keys between different devices (or even parallel installations on the same system) is a recipe for big security breaches (just like sharing passwords between different web services).

How much bigger security breach than using Windows to do the keys in the first place?

There is no real problem distributing keys offline.

And routers and low end crypto devices are really bad choices for use of generating crypto keys anyway, simply because they don’t have any good RNG to get meaningful entropy data.

Especially in that case, don't re-use the 'deemed less-reliable' keys on 'deemed more-reliable' systems.

Wouldn’t the key be found at C:\Users\admin\ssh-wrt?

1 Like

well, strange, yes those files are located in C:\Users\admin\
image

Makes sense to me. You were in the “admin” directory when you ran the command and you overrode the default path and filename with just the ssh-wrt filename and no path, so it saved it in the current directory with the name given.

how to use it for the windows terminal?
Again, I was able to use it in putty by converting it, but how to use in windows terminal?

Move the 2 files to c:\users\admin\.ssh\ and either: rename them as id_rsa, or pass them to the ssh command via the -i parameter with the existing name, or create a config file in .ssh using the IdentityFile option to point to your custom key file filename.

Windows ssh client will behave much like a regular OpenSSH client so you can refer to a lot of the online docs for syntax help.

You mean like this

Yes, that’s step 1. If you want the ssh client to find your key automatically rename from ssh-wrt_rsa to id_rsa (same for .pub file).

2 Likes

image
working

with following filenames

1 Like