ubuntu - Cygwin SSH 到 Amazon EC2 Ubuntu 挂起

标签 ubuntu ssh amazon-ec2 cygwin

我正在尝试使用 Win 8 框中全新安装的 Cygwin 连接到 EC2 上新创建的 ubuntu 实例,现在看到我的 ssh 连接挂起而没有任何错误消息。

我只是想像这样连接到实例;

ssh -vvvi xxx.pem ec2-user@xxx.compute.amazonaws.com

用于创建实例文件的 .pem 位于 .ssh 目录中,具有以下(据我所知)属性;
$ ls -l
total 4
-r-------- 1 xxx Users 1696 Nov  3 11:38 xxx.pem

连接开始并且与实例的初始握手似乎发生了,但是连接只是挂起,没有任何真正的错误消息或超时。详细日志如下。

在 AWS 方面,我只使用默认安全组,它允许通过端口 22 向实例传入。

将 .pem 转换为 putty 所需的 key 格式后,Putty 工作正常。

自从对 Linux 实例做任何事情以来已经有很多年了,而且还没有 Cygwin
安装时间同样长,所以我真的迷路了。

完整输出:
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
Pseudo-terminal will not be allocated because stdin is not a terminal.
debug2: ssh_connect: needpriv 0
debug1: Connecting to xxx.compute.amazonaws.com [xx.xx.xx.xx] port 22.
debug1: Connection established.
debug3: Not a RSA1 key file xxx.pem.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file xxx.pem type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2p2 Ubuntu-6
debug1: match: OpenSSH_6.2p2 Ubuntu-6 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_init: found hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_init: found hmac-md5
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 112/256
debug2: bits set: 508/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: filename /c/cygwin64/home/xxx/.ssh/known_hosts
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug3: check_host_in_hostfile: filename /c/cygwin64/home/xxx/.ssh/known_hosts
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug3: check_host_in_hostfile: filename /c/cygwin64/home/xxx/.ssh/known_hosts
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug2: no key of type 0 for host xxx.compute.amazonaws.com
debug3: check_host_in_hostfile: filename /c/cygwin64/home/xxx/.ssh/known_hosts2
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts2
debug3: check_host_in_hostfile: filename /c/cygwin64/home/xxx/.ssh/known_hosts
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug2: no key of type 2 for host xxx.compute.amazonaws.com

在最后一条调试消息之后什么都没有发生,没有错误,没有超时,什么都没有......

最佳答案

这肯定会奏效,它对我有用,而且我已经在工作中遇到了许多其他人:
确保以管理员身份启动 cygwin

  • 在 cygwin 中创建一个文件夹,该文件夹可由名为/.ssh
  • 的终端查看
  • 您可以通过在命令行中执行 mkdir .foldername 在 Windows 中创建一个带点的文件夹

    3.从文件夹外部执行此命令:chgrp Users ~/.ssh/name_Of_The_Key.pem
  • chmod 600 ~/.ssh/name_Of_The_Key.pem
  • 连接到它。

  • 从 .ssh 文件夹中运行命令

    ssh -i name_Of_The_Key.pem ubuntu@52.25.57.43

    关于ubuntu - Cygwin SSH 到 Amazon EC2 Ubuntu 挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19754608/

    相关文章:

    java - 在 ubuntu 服务器上启动 spring boot jar 的问题。启动 ApplicationContext 时出错

    linux - 使用 Chef 创建用户,以便我可以 ssh 进入盒子

    python - 使用一组过滤器在给定区域中最新的 AMI ID

    AWS EC2 上的 Wordpress - 分配弹性 IP 后损坏

    java - 使用 SAXON 变压器工厂转换 XML,该工厂不能在 Centos AWS 上运行,但可以在本地运行

    使用 cmake 和 pybind11 构建示例应用程序时找不到 Python.h

    docker - 在 Dockerfile 中设置 bind9 时面临问题

    python - 使用 Docker 的名称解析 [Errno -3] 暂时失败

    authentication - 无法连接到 aws ec2 实例,主机 key 验证失败

    java - Ganymed SSH - 更改用户