SSHD Windows 10 Not Accepting Public Key

If you’re experiencing issues with SSHD on Windows 10 not accepting your public key, there are a few steps you can take to troubleshoot the problem. Follow the steps below to resolve the issue.

Step 1: Open the SSHD Configuration File

To begin, open the SSHD configuration file using a text editor. In this example, we’ll use the Bash shell and the vim editor. Open a command prompt and navigate to the following directory:

1
C:\ProgramData\ssh

Then, run the following command to open the SSHD configuration file:

1
bash -c 'vim sshd_config'

Step 2: Verify the AuthorizedKeysFile Path

In the SSHD configuration file, look for the section that starts with Match Group administrators. Within this section, there should be a line specifying the path to the authorized keys file. By default, it should be set to:

1
AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys

Ensure that this line is not commented out (i.e., not preceded by a #), as it needs to be active for SSHD to recognize the authorized keys.

Step 3: Check File Permissions

Next, verify the file permissions of the authorized keys file. By default, the file should be located at:

1
C:\ProgramData\ssh\administrators_authorized_keys

Right-click on the file, select “Properties,” and navigate to the “Security” tab. Make sure that the user account you are connecting with has appropriate permissions to read the file.

Step 4: Restart the SSHD Service

After making any changes to the SSHD configuration file or file permissions, you need to restart the SSHD service for the changes to take effect. Open a command prompt with administrative privileges and run the following command:

1
2
net stop sshd
net start sshd

This will stop and start the SSHD service, allowing the changes to be applied.

Step 5: Attempt SSH Connection

Once the SSHD service is restarted, try connecting to your Windows 10 machine using the SSH key. If the authorized keys file and permissions are correctly set, the public key should be accepted, and you should be able to log in successfully.

If you’re still experiencing issues, double-check the SSHD configuration file for any typos or mistakes. Additionally, ensure that the public key you’re using is correctly formatted and matches the corresponding private key.

By following these steps, you should be able to resolve the issue of SSHD on Windows 10 not accepting your public key.

0%