Answer the question
In order to leave comments, you need to log in
Why can't I send my SSH public key from Linux to Windows?
Good day everyone, this is the situation - I want from Linux, Ubuntu 20.04, connect to Windows 10 20H2 remotely via SSH
, I set everything up, and on Ubuntu and on Windows the sshd service works, the port listens, I generated keys on both Windows and Ubuntu, I
tried to connect first without authorization by keys - only by password, everything is OK, from ubunta I connected to Windows, I executed
$ssh [email protected]
entered the password and that's it, I'm in Windows, but I need authorization by keys,
In /etc/ssh/sshd_config I set the line PubkeyAuthentication yes
Also and in Windows in the file c:\windows\system32\openssh\sshd_config
sshd and restarted here and there I
execute
$ssh-copy-id [email protected]
I get the following output:
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password:
"exec" �� ���� ����७��� ��� ���譥�
��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���.
�⪠���� � ����㯥.
���⥬� �� 㤠���� ���� 㪠����� ����.
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
"exec" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.
Отказано в доступе.
Системе не удается найти указанный путь.
Answer the question
In order to leave comments, you need to log in
You need to look through the configuration of your sshd server on Windows and see where it thinks the user's public keys should be.
It could be either $USERHOME/.ssh/authorized_keys or $USERHOME/.ssh/authorized_keys2 or anything else.
ssh-copy-id may not know where the public keys should be in Windows, it makes no sense to use it in this case.
Read the documentation for the Windows sshd server to understand where it looks for the user's public keys.
1. It is necessary to %programdata%\ssh\sshd_config
register
Match User YOU
AuthorizedKeysFile C:/Users/YOU/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub | ssh [email protected] 'mkdir -p ~/.ssh && type con >> C:/Users/YOU/.ssh/authorized_keys'
scp ~/.ssh/id_rsa.pub WINDOWS_IP:C:/Users/YOU/.ssh/authorized_keys
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question