Copy SSH Key from Windows 10/11 to Linux Host

In recent versions of Windows 10/11 you can enable both an SSH client and server. This post assumes that you have the SSH client enabled and you have generated SSH keys.

You can generate SSH keys with the ssh-keygen.exe command.

Make It So
Once you have your SSH keys generated, the following command will copy them to the target host. It will also create the ~/.ssh/ directory and the authorized_keys file if they do not exist.

Run this oneliner from the terminal.

cat ~/.ssh/ | ssh <user>@<host> "cat >> ~/.ssh/authorized_keys"

So for example: cat ~/.ssh/ | ssh “cat >> ~/.ssh/authorized_keys”

Hope this helps!!