问题描述
全部
我把旧的 Windows 计算机变成了服务器。我希望能够在不使用密码的情况下通过 SSH 进行连接。我无法使用 Sample.exe
,因为没有人记得密码。我尝试将我的 ssh 公钥手动粘贴到 ssh-copy-id
中,但是当我执行 C:\Users\user\.ssh\authorized_keys
时,仍然提示我输入密码。这是输出:
ssh -v user@$HOST
一些论坛帖子声称这是 (base) XXXXX@My-MacBook-Pro ~ % ssh -v XXXXX@XXX.XXX.XXX.XXX
OpenSSH_8.1p1,LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to XXX.XXX.XXX.XXX [XXX.XXX.XXX.XXX] port 22.
debug1: Connection established.
debug1: identity file /Users/XXXXX/.ssh/id_rsa type 0
debug1: identity file /Users/XXXXX/.ssh/id_rsa-cert type -1
debug1: identity file /Users/XXXXX/.ssh/id_dsa type -1
debug1: identity file /Users/XXXXX/.ssh/id_dsa-cert type -1
debug1: identity file /Users/XXXXX/.ssh/id_ecdsa type -1
debug1: identity file /Users/XXXXX/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/XXXXX/.ssh/id_ed25519 type -1
debug1: identity file /Users/XXXXX/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/XXXXX/.ssh/id_xmss type -1
debug1: identity file /Users/XXXXX/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0,remote software version OpenSSH_for_Windows_7.7
debug1: match: OpenSSH_for_Windows_7.7 pat OpenSSH* compat 0x04000000
debug1: Authenticating to XXX.XXX.XXX.XXX:22 as 'XXXXX'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:FfgvWKV3j7yQbkir5hFTe/JzYtXTHpmVZ2/8Yqcclas
debug1: Host 'XXX.XXX.XXX.XXX' is kNown and matches the ECDSA host key.
debug1: Found key in /Users/XXXXX/.ssh/kNown_hosts:4
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /Users/XXXXX/.ssh/id_rsa RSA SHA256:9oWgqJ2MsMwSaR6AMNWnBkuacnVf7PkQSR+SG1Q6ptI
debug1: Will attempt key: /Users/XXXXX/.ssh/id_dsa
debug1: Will attempt key: /Users/XXXXX/.ssh/id_ecdsa
debug1: Will attempt key: /Users/XXXXX/.ssh/id_ed25519
debug1: Will attempt key: /Users/XXXXX/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/XXXXX/.ssh/id_rsa RSA SHA256:9oWgqJ2MsMwSaR6AMNWnBkuacnVf7PkQSR+SG1Q6ptI
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /Users/XXXXX/.ssh/id_dsa
debug1: Trying private key: /Users/XXXXX/.ssh/id_ecdsa
debug1: Trying private key: /Users/XXXXX/.ssh/id_ed25519
debug1: Trying private key: /Users/XXXXX/.ssh/id_xmss
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: password
XXXXX@XXX.XXX.XXX.XXX's password:
目录和 .ssh
文件(例如 here)的权限问题。运行authorized_keys
(使用python)我们发现os.stat
有666个权限,但是python的os.chmod为windows做了not fully work并且不清楚如何在windows中获得正确的数字权限,最好通过命令行,因为 GUI 非常滞后且难以使用(最好使用 Python,因为这是我最强大的语言)。
权限问题在 Windows 中会成为问题吗?如果是这样,正确的权限是什么,我们如何像在 UNIX (chmod) 中那样更改它们?如果没有,可能是什么问题导致 ssh 提示输入密码?
从技术上讲,我可以格式化并重新安装操作系统(或者更好的是安装 Linux),但我真的很想避免这种情况,因为服务器已经启动并正在运行。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)