我刚刚在我的 Win10 机器上安装了 OpenSSH,以便能够从运行最新 Raspbian 的 Raspberry Pi 上执行命令。
我可以使用密码从 MacBook 和 Pi 登录到 Win10 机器上的 SSH 服务器。但是,如果我在ssh-keygen -t rsa
Pi 或 Mac 上生成公钥,我想使用它来无需密码登录(例如,从 Pi 到我的两台 Mac 都可以正常使用!),Win10 上的 openSSH 服务器会立即关闭连接。我只能使用 进行连接。使用-o PubkeyAuthentication=no
此方法,我还将公钥复制到了 Win10 机器,但没有变化……只要它们出现在客户端机器上,就会发生这种情况。
我尝试登录时收到的日志是:
OpenSSH_6.7p1 Raspbian-5+deb8u3, OpenSSL 1.0.1t 3 May 2016 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to 90.0.0.2 [90.0.0.2] port 22. debug1: Connection established. debug1: identity file /home/pi/.ssh/id_rsa type 1 debug1: key_load_public: No such file or directory debug1: identity file /home/pi/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/pi/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/pi/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/pi/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/pi/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/pi/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/pi/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Raspbian-5+deb8u3 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.3 debug1: match: OpenSSH_7.3 pat OpenSSH* compat 0x04000000 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr [email protected] none debug1: kex: client->server aes128-ctr [email protected] none debug1: sending SSH2_MSG_KEX_ECDH_INIT debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ECDSA 26:5e:3e:02:91:90:15:8a:1d:3f:ff:e1:2a:2b:33:8b debug1: Host '90.0.0.2' is known and matches the ECDSA host key. debug1: Found key in /home/pi/.ssh/known_hosts:3 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received ****USAGE WARNING**** This is a private computer system. This computer system, including all related equipment, networks, and network devices (specifically including Internet access) are provided only for authorized use. This computer system may be monitored for all lawful purposes, including to ensure that its use is authorized, for management of the system, to facilitate protection against unauthorized access, and to verify security procedures, survivability, and operational security. Monitoring includes active attacks by authorized entities to test or verify the security of this system. During monitoring, information may be examined, recorded, copied and used for authorized purposes. All information, including personal information, placed or sent over this system may be monitored. Use of this computer system, authorized or unauthorized, constitutes consent to monitoring of this system. Unauthorized use may subject you to criminal prosecution. Evidence of unauthorized use collected during monitoring may be used for administrative, criminal, or other adverse action. Use of this system constitutes consent to monitoring for these purposes. debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Next authentication method: publickey debug1: Offering RSA public key: /home/pi/.ssh/id_rsa Connection closed by 90.0.0.2
答案1
我现在改用“PowershellServer”,它对私人用户免费,并且每次只能使用一个连接(这正是我的情况),并且支持公钥身份验证。它运行良好,并且易于设置,因为它具有良好的图形用户界面。