【问题标题】:ssh connection using cygwin使用 cygwin 的 ssh 连接
【发布时间】:2012-06-17 04:21:19
【问题描述】:

我正在尝试使用 cygwin+ssh 连接我的远程 linux 服务器,但身份验证失败且没有明显原因。我已经成功设置了另一个到 github 的连接,并且我遵循了相同的过程,这就是我在这里停下来的原因

$ ssh -v finxxx@xxx.79.xxx.29
OpenSSH_6.0p1, OpenSSL 1.0.1c 10 May 2012
debug1: Connecting to xxx.79.xxx.29 [xxx.79.xxx.29] port 22.
debug1: Connection established.
debug1: identity file /home/xxxtta/.ssh/id_rsa type -1
debug1: identity file /home/xxxtta/.ssh/id_rsa-cert type -1
debug1: identity file /home/xxxtta/.ssh/id_dsa type 2
debug1: identity file /home/xxxtta/.ssh/id_dsa-cert type -1
debug1: identity file /home/xxxtta/.ssh/id_ecdsa type -1
debug1: identity file /home/xxxtta/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu7
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu7 pat OpenSSH_5*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA c7:b2:f1:f9:76:cd:24:5a:80:91:4b:e5:ac:7e:e1:ee
debug1: Host 'xxx.79.xxx.29' is known and matches the RSA host key.
debug1: Found key in /home/xxxtta/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/xxxtta/.ssh/id_rsa
debug1: Offering DSA public key: /home/xxxtta/.ssh/id_dsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/xxxtta/.ssh/id_ecdsa
debug1: No more authentication methods to try.
Permission denied (publickey).

我已经做了标准的东西,但我无法解决问题。这些是我用来生成私钥/公钥的命令。然后我将公钥复制到服务器

$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/xxxtta/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/xxxtta/.ssh/id_dsa.
Your public key has been saved in /home/xxxtta/.ssh/id_dsa.pub

感谢您的帮助

编辑: 我已经使用 MINGW 进行了相同的程序并且它可以工作(我能够连接)。我的系统中的 cygwin 肯定有问题

【问题讨论】:

  • 您是否将您的 id_dsa.pub 添加到远程服务器上的~/.ssh/authorized_keys
  • 是的,我已经复制了远程服务器上authorized_keys下的公钥
  • 我知道这已经有好几年了,但如果知道在您的具体情况下解决方案是什么会很有趣!

标签: windows ssh cygwin


【解决方案1】:

问题可能在于用户名。如果您远程登录,用户名区分大小写。您必须完全按照 Windows 中的定义编写用户名。

【讨论】:

    【解决方案2】:

    将 id_dsa.pub 复制到您的远程服务器。

    # scp .ssh/id_dsa.pub dude@remotemachine
    

    在远程服务器上:

    # cat id_dsa.pub >> ~/.ssh/authorized_keys 
    

    【讨论】:

    • 是的,我已经复制了密钥:/在此之前我已经完成了几次完整的步骤,我对该过程并不完全陌生
    【解决方案3】:

    您可以尝试使用 -vvv 而不是 -v 来增加详细程度。
    此外,请检查文件权限是否设置正确。见Adding public key to ~/.ssh/authorized_keys does not log me in automatically

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-02-05
      • 2013-11-05
      • 2011-10-12
      • 1970-01-01
      • 2011-12-06
      • 2012-11-08
      • 2014-08-09
      • 2016-05-20
      相关资源
      最近更新 更多