I tried executing the following command on Mac OS:
ssh-copy-id windows_username@windows_ip
however, the following results were returned, and password-free login was not configured successfully:
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/mac_username/.ssh/id_rsa.pub"
/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
windows_username@windows_ip's password:
'exec' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'windows_username@windows_ip'"
and check to make sure that only the key(s) you wanted were added.
Why does garbled code appear? I opened the authorized_keys file on the windows system myself, the content of which are as follows(The systems I use are all in Chinese):
ECHO 处于打开状态。
This content translated into English is: ECHO is on. Why does this happen?
Later, I manually copied the public key on the Mac OS to the authorized_keys file in Windows, but I still couldn't log in to Windows on the Mac OS without a password.
How to deal with this? I've tried everything I can think of. Thank you in advance for your help.
Update:
According to this post, it mentions commenting out the following two lines in the sshd_config file:
Match Group administrators
AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys
When I commented out these two lines and manually added the public key on the Mac OS to authorized_keys, the password-free login did take effect.
But adding it manually seems a bit clumsy. Then I deleted file authorized_keys, and then tried to use ssh-copy-id to automatically add it. The result was that it was not added successfully. Why?