1

I'm having quite a hard time with ssh keys.

To explain the context, I'm trying to ssh my VM (my computer is the client and the VM on it is the server). For now, it works using password authentication but I'd like to make it work with ssh keys.

I'm on windows and despite being reading a lot of similar topics, I can't find a solution.

error message

For now, I've tried a lot of things such as :

  • Changing administrators_authorized_keys file permissions (for some reason, I'm in the Administrator group however I can't open files in ssh directory if I don't give full control to my account (admin).
  • Generate keys using Puttygen and ssh-keygen
  • Uncomment this line : PubkeyAuthentication yes in sshd_config
  • Debug through Powershell using sshd -ddd ; The server is listening but I can't see any connection even though I'm trying to ssh it.

I'm feeling quite out of options now.

I thank you in advance for your answers.

4
  • What version of sshd and PuTTY are you using? + Does your administrators_authorized_keys have plain ASCII encoding (no UTF-16, or maybe UTF-8 BOM)? Commented Dec 24, 2021 at 7:55
  • You will need to provide the verbose logs for the server. You will also have to provide your server configuration file. You should also NOT use administrators_authorized_keys and use a key specific to your single user.
    – Ramhound
    Commented Dec 24, 2021 at 8:00
  • Martin Prikryl - I've download Openssh and Putty 2 days ago, so I suppose it's the latest versions. - I'm not home so I can't verify the encoding right now but I will as soon as I can. @Ramhound - Should I use sshd -V to display logs or is there another way ? - I will send the sshd_config as soon as I can.
    – Lunette
    Commented Dec 24, 2021 at 8:18
  • Versions : - Putty : 0.76 - sshd : Don't know where to find it but I downloaded openssh server. The administrators_authorized_keys was in UTF-8 so I changed it but whenever I open it as a .txt it switches back. About the verbose logs I don't really know how to display it but this is a link for my sshd_conf : filedropper.com/d/s/SJFDdVB8lAFzZyTCJ7ki03VKQq2wKV
    – Lunette
    Commented Dec 24, 2021 at 16:03

1 Answer 1

1

I finally found a solution.

I enabled compression on Putty -> category -> SSH I changed permissions on both file and directory of my users :

  • Owner : user

  • Fullcontrol for Administrator group and System group and desactivate inherited permissions

Thank you for your time.

1
  • How does compression relate to the server rejecting the key? AFAIK, that wouldn't affect key authentication - the server log will list what key was refused - does it match the key permissions were changed on? Usually the cause of such an error is either: incorrect settings within sshd_config, public key not added to the correct authorized_keys file, wrong key is being used, and less likely, but occasionally, a malformed key file due to an extra whitespace in the wrong spot. OpenSSH server must be restarted to reload any sshd_config file changes
    – JW0914
    Commented Sep 5, 2023 at 14:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .