Linux to Windows SSH authorized_keys

linuxsshssh-keysUbuntuwindows

I want to connect into a Windows Box from my Ubuntu PC via ssh using key authentication but I don't know how to do it.

I've tried to send the id_rsa.pub to Windows and then rename it to authorized_keys (placing this file into the C:\Users\Administrador\.ssh\'s directory), but it keeps prompting me the password. It seems like the system doesn't recognize the file properly.

I've also tried with ssh-copy-id's command but after connecting to Windows it gives me an error.

Any solution?

PS: I am using OpenSSH for Windows installed through the Chocolatey repositories.

Best Answer

I did not have luck with ssh-copy-id under windows so send the contents of your public key on a different way like copy and paste while connected via ssh by password.

Than you can try different locations for the authorized_keys file.

  1. Your users .ssh folder
  2. Your users .ssh folder, but call the file administrators_authorized_keys. This is needed if your user has admin rights.
  3. In the folder C:\ProgramData\ssh
  4. In the folder C:\ProgramData\ssh, but call the file administrators_authorized_keys. This is needed if your user has admin rights.

For me, solution 4 worked. I installed openSSH server by activating a windows 11 feature, not via choco.