Configuring OpenSSH Server on Windows to Authenticate Using SSH Keys
You can copy the public key to the SSH server using SCP:
scp C:\Users\youruser\.ssh\id_rsa.pub admin@192.168.1.15:c:\users\admin\.ssh\authorized_keys
Login Windows Using SSH Key Under Local Admin
OpenSSH uses special key-based access settings for the users with Windows local administrator privileges.
First of all, use a key file C:\ProgramData\ssh\administrators_authorized_keys instead of the authorized_keys file in the user profile. You must add your SSH key to this text file (for security purposes, only the Administrators group and SYSTEM should have permissions to read this file).
In order to use the authorized_keys file from a user profile and not to move the public key data to the administrators_authorized_keys file, you can comment the related line in the OpenSSH configuration file (C:\ProgramData\ssh\sshd_config).
Comment these lines:
#Match Group administrators
# AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys
Allow access Windows using RSA keys in the sshd_config file:
PubkeyAuthentication yes
Don’t forget to restart the sshd service after saving changes in sshd_config.
restart-service sshd
Comments
Post a Comment