【问题标题】:Using SSH Keygen not able to connect to server on Windows 10 GIT使用 SSH Keygen 无法连接到 Windows 10 GIT 上的服务器
【发布时间】:2016-08-11 16:57:36
【问题描述】:

我正在关注以下教程。

https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2

它是在 Windows 10 上生成的文件C:\Users\<user name>\.ssh

我正在使用 GIT 生成文件。

 ~/Desktop
$ PermitRootLogin without-password
bash: PermitRootLogin: command not found

$ ssh a@b.com
a@b.com's password:
Permission denied, please try again.

我使用puttygen.exe 生成了.ppk 文件。
仍然无法连接到服务器。

通过ssh -Tv a@b.com

它会给出以下响应

OpenSSH_7.1p2, OpenSSL 1.0.2h  3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to a@b.com [XXX.XXX.XXX.XX] port 22.
debug1: Connection established.
debug1: identity file /c/Users/XUser/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/XUser/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to a@b.com:22 as 'XUser'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:WrjAO7ldoJ3vjYENd6v7JvxXkbquvvom16RYGKeRO70
debug1: Host 'a@b.com' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/XUser/.ssh/known_hosts:2
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
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/XUser/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /c/Users/XUser/.ssh/id_dsa
debug1: Trying private key: /c/Users/XUser/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/XUser/.ssh/id_ed25519
debug1: Next authentication method: password
XUser@a@b.com's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
XUser@a@b.com's password:

【问题讨论】:

    标签: windows git ssh private-key


    【解决方案1】:

    如果你有

    • 您的公钥:C:\Users\&lt;user name&gt;\.ssh\id_rsa.pub
    • 您的私钥:C:\Users\&lt;user name&gt;\.ssh\id_rsa

    请复制您的公钥(请参阅“How To Use SSH Keys with DigitalOcean Droplets”)

    【讨论】:

    • @MikeSmith 所以你有 id_rsa 和 id_rsa.pub?
    • @MikeSmith 你确定你复制了没有任何“换行符”的密钥(它应该是一个连续的行)
    • 是的,我有 id_rsa 和 id_rsa.pub。是复制没有任何“换行符”谢谢
    • @MikeSmith 那么当您执行ssh a@b.com 时,您确定要连接的用户“a”吗?
    • @MikeSmith 抱歉之前的简短评论,我有点着急。让我来说明一下:例如,如果您尝试通过 ssh 连接到 GitHub.com,您将不会使用您的 GitHub 登录 (ssh mylogin@github.com):那将永远起作用。你需要使用 git:ssh git@github.com。也许这与 DigitalOcean 类似。
    猜你喜欢
    • 1970-01-01
    • 2019-02-06
    • 2019-07-09
    • 2019-02-26
    • 2018-09-27
    • 2017-11-08
    • 2011-06-01
    • 2020-07-12
    • 2016-09-02
    相关资源
    最近更新 更多