连接被阻止,因为服务器仅允许公钥认证

连接被阻止,因为服务器仅允许公钥认证

我刚刚创建了一个 EC2 实例来托管我的 Django 项目,并且我正尝试通过 PuTTY 连接到该实例,因为我使用的是 Windows 10(公司 PC)。

我尝试遵循文档使用 Amazon Linux 和 Ubuntu Server 18.04 发行版的步骤,我总是从 PuTTY 收到以下错误:

由于服务器仅允许公钥身份验证,连接被阻止。请联系您的网络管理员。

PuTTY 事件日志:

2019-07-31 11:02:59 Looking up host "ec2-54-94-181-255.sa-east-1.compute.amazonaws.com" for SSH connection
2019-07-31 11:02:59 Connecting to 54.94.181.255 port 22
2019-07-31 11:02:59 We claim version: SSH-2.0-PuTTY_Release_0.72
2019-07-31 11:02:59 Remote version: SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
2019-07-31 11:02:59 Using SSH protocol version 2
2019-07-31 11:02:59 No GSSAPI security context available
2019-07-31 11:02:59 Doing ECDH key exchange with curve Curve25519 and hash SHA-256 (unaccelerated)
2019-07-31 11:02:59 Server also has ecdsa-sha2-nistp256/ssh-rsa host keys, but we don't know any of them
2019-07-31 11:02:59 Host key fingerprint is:
2019-07-31 11:02:59 ssh-ed25519 255 b1:3f:8a:d8:03:a8:da:69:ae:9c:ba:75:ea:6f:ac:2f
2019-07-31 11:02:59 Initialised AES-256 SDCTR (AES-NI accelerated) outbound encryption
2019-07-31 11:02:59 Initialised HMAC-SHA-256 (unaccelerated) outbound MAC algorithm
2019-07-31 11:02:59 Initialised AES-256 SDCTR (AES-NI accelerated) inbound encryption
2019-07-31 11:02:59 Initialised HMAC-SHA-256 (unaccelerated) inbound MAC algorithm
2019-07-31 11:02:59 Reading key file "C:\Users\claudemirsfj\Downloads\ubuntuKey.ppk"
2019-07-31 11:03:00 Pageant is running. Requesting keys.
2019-07-31 11:03:00 Pageant has 1 SSH-2 keys
2019-07-31 11:03:00 Configured key file not in Pageant
2019-07-31 11:03:00 Remote side sent disconnect message type 2 (protocol error): "Connection blocked because server only allows public key authentication. Please contact your network administrator."

SSH 数据包日志:

Event Log: Looking up host "ec2-54-94-181-255.sa-east-1.compute.amazonaws.com" for SSH connection
Event Log: Connecting to 54.94.181.255 port 22
Event Log: We claim version: SSH-2.0-PuTTY_Release_0.72
Event Log: Remote version: SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
Event Log: Using SSH protocol version 2
Event Log: No GSSAPI security context available
Outgoing packet #0x0, type 20 / 0x14 (SSH2_MSG_KEXINIT)
  00000000  4c ff b5 45 a0 b7 6b dc c8 41 68 8f 30 93 b8 1c  L..E..k..Ah.0...
  00000010  00 00 01 0e 63 75 72 76 65 32 35 35 31 39 2d 73  ....curve25519-s
  00000020  68 61 32 35 36 40 6c 69 62 73 73 68 2e 6f 72 67  [email protected]
  00000030  2c 65 63 64 68 2d 73 68 61 32 2d 6e 69 73 74 70  ,ecdh-sha2-nistp
  00000040  32 35 36 2c 65 63 64 68 2d 73 68 61 32 2d 6e 69  256,ecdh-sha2-ni
  00000050  73 74 70 33 38 34 2c 65 63 64 68 2d 73 68 61 32  stp384,ecdh-sha2
  00000060  2d 6e 69 73 74 70 35 32 31 2c 64 69 66 66 69 65  -nistp521,diffie
  00000070  2d 68 65 6c 6c 6d 61 6e 2d 67 72 6f 75 70 2d 65  -hellman-group-e
  00000080  78 63 68 61 6e 67 65 2d 73 68 61 32 35 36 2c 64  xchange-sha256,d
  00000090  69 66 66 69 65 2d 68 65 6c 6c 6d 61 6e 2d 67 72  iffie-hellman-gr
  000000a0  6f 75 70 2d 65 78 63 68 61 6e 67 65 2d 73 68 61  oup-exchange-sha
  000000b0  31 2c 64 69 66 66 69 65 2d 68 65 6c 6c 6d 61 6e  1,diffie-hellman
  000000c0  2d 67 72 6f 75 70 31 34 2d 73 68 61 32 35 36 2c  -group14-sha256,
  000000d0  64 69 66 66 69 65 2d 68 65 6c 6c 6d 61 6e 2d 67  diffie-hellman-g
  000000e0  72 6f 75 70 31 34 2d 73 68 61 31 2c 72 73 61 32  roup14-sha1,rsa2
  000000f0  30 34 38 2d 73 68 61 32 35 36 2c 72 73 61 31 30  048-sha256,rsa10
  00000100  32 34 2d 73 68 61 31 2c 64 69 66 66 69 65 2d 68  24-sha1,diffie-h
  00000110  65 6c 6c 6d 61 6e 2d 67 72 6f 75 70 31 2d 73 68  ellman-group1-sh
  00000120  61 31 00 00 00 57 73 73 68 2d 65 64 32 35 35 31  a1...Wssh-ed2551
  00000130  39 2c 65 63 64 73 61 2d 73 68 61 32 2d 6e 69 73  9,ecdsa-sha2-nis
  00000140  74 70 32 35 36 2c 65 63 64 73 61 2d 73 68 61 32  tp256,ecdsa-sha2
  00000150  2d 6e 69 73 74 70 33 38 34 2c 65 63 64 73 61 2d  -nistp384,ecdsa-
  00000160  73 68 61 32 2d 6e 69 73 74 70 35 32 31 2c 73 73  sha2-nistp521,ss
  00000170  68 2d 72 73 61 2c 73 73 68 2d 64 73 73 00 00 00  h-rsa,ssh-dss...
  00000180  bd 61 65 73 32 35 36 2d 63 74 72 2c 61 65 73 32  .aes256-ctr,aes2
  00000190  35 36 2d 63 62 63 2c 72 69 6a 6e 64 61 65 6c 2d  56-cbc,rijndael-
  000001a0  63 62 63 40 6c 79 73 61 74 6f 72 2e 6c 69 75 2e  [email protected].
  000001b0  73 65 2c 61 65 73 31 39 32 2d 63 74 72 2c 61 65  se,aes192-ctr,ae
  000001c0  73 31 39 32 2d 63 62 63 2c 61 65 73 31 32 38 2d  s192-cbc,aes128-
  000001d0  63 74 72 2c 61 65 73 31 32 38 2d 63 62 63 2c 63  ctr,aes128-cbc,c
  000001e0  68 61 63 68 61 32 30 2d 70 6f 6c 79 31 33 30 35  hacha20-poly1305
  000001f0  40 6f 70 65 6e 73 73 68 2e 63 6f 6d 2c 33 64 65  @openssh.com,3de
  00000200  73 2d 63 74 72 2c 33 64 65 73 2d 63 62 63 2c 62  s-ctr,3des-cbc,b
  00000210  6c 6f 77 66 69 73 68 2d 63 74 72 2c 62 6c 6f 77  lowfish-ctr,blow
  00000220  66 69 73 68 2d 63 62 63 2c 61 72 63 66 6f 75 72  fish-cbc,arcfour
  00000230  32 35 36 2c 61 72 63 66 6f 75 72 31 32 38 00 00  256,arcfour128..
  00000240  00 bd 61 65 73 32 35 36 2d 63 74 72 2c 61 65 73  ..aes256-ctr,aes
  00000250  32 35 36 2d 63 62 63 2c 72 69 6a 6e 64 61 65 6c  256-cbc,rijndael
  00000260  2d 63 62 63 40 6c 79 73 61 74 6f 72 2e 6c 69 75  [email protected]
  00000270  2e 73 65 2c 61 65 73 31 39 32 2d 63 74 72 2c 61  .se,aes192-ctr,a
  00000280  65 73 31 39 32 2d 63 62 63 2c 61 65 73 31 32 38  es192-cbc,aes128
  00000290  2d 63 74 72 2c 61 65 73 31 32 38 2d 63 62 63 2c  -ctr,aes128-cbc,
  000002a0  63 68 61 63 68 61 32 30 2d 70 6f 6c 79 31 33 30  chacha20-poly130
  000002b0  35 40 6f 70 65 6e 73 73 68 2e 63 6f 6d 2c 33 64  [email protected],3d
  000002c0  65 73 2d 63 74 72 2c 33 64 65 73 2d 63 62 63 2c  es-ctr,3des-cbc,
  000002d0  62 6c 6f 77 66 69 73 68 2d 63 74 72 2c 62 6c 6f  blowfish-ctr,blo
  000002e0  77 66 69 73 68 2d 63 62 63 2c 61 72 63 66 6f 75  wfish-cbc,arcfou
  000002f0  72 32 35 36 2c 61 72 63 66 6f 75 72 31 32 38 00  r256,arcfour128.
  00000300  00 00 9b 68 6d 61 63 2d 73 68 61 32 2d 32 35 36  ...hmac-sha2-256
  00000310  2c 68 6d 61 63 2d 73 68 61 31 2c 68 6d 61 63 2d  ,hmac-sha1,hmac-
  00000320  73 68 61 31 2d 39 36 2c 68 6d 61 63 2d 6d 64 35  sha1-96,hmac-md5
  00000330  2c 68 6d 61 63 2d 73 68 61 32 2d 32 35 36 2d 65  ,hmac-sha2-256-e
  00000340  74 6d 40 6f 70 65 6e 73 73 68 2e 63 6f 6d 2c 68  [email protected],h
  00000350  6d 61 63 2d 73 68 61 31 2d 65 74 6d 40 6f 70 65  mac-sha1-etm@ope
  00000360  6e 73 73 68 2e 63 6f 6d 2c 68 6d 61 63 2d 73 68  nssh.com,hmac-sh
  00000370  61 31 2d 39 36 2d 65 74 6d 40 6f 70 65 6e 73 73  a1-96-etm@openss
  00000380  68 2e 63 6f 6d 2c 68 6d 61 63 2d 6d 64 35 2d 65  h.com,hmac-md5-e
  00000390  74 6d 40 6f 70 65 6e 73 73 68 2e 63 6f 6d 00 00  [email protected]..
  000003a0  00 9b 68 6d 61 63 2d 73 68 61 32 2d 32 35 36 2c  ..hmac-sha2-256,
  000003b0  68 6d 61 63 2d 73 68 61 31 2c 68 6d 61 63 2d 73  hmac-sha1,hmac-s
  000003c0  68 61 31 2d 39 36 2c 68 6d 61 63 2d 6d 64 35 2c  ha1-96,hmac-md5,
  000003d0  68 6d 61 63 2d 73 68 61 32 2d 32 35 36 2d 65 74  hmac-sha2-256-et
  000003e0  6d 40 6f 70 65 6e 73 73 68 2e 63 6f 6d 2c 68 6d  [email protected],hm
  000003f0  61 63 2d 73 68 61 31 2d 65 74 6d 40 6f 70 65 6e  ac-sha1-etm@open
  00000400  73 73 68 2e 63 6f 6d 2c 68 6d 61 63 2d 73 68 61  ssh.com,hmac-sha
  00000410  31 2d 39 36 2d 65 74 6d 40 6f 70 65 6e 73 73 68  1-96-etm@openssh
  00000420  2e 63 6f 6d 2c 68 6d 61 63 2d 6d 64 35 2d 65 74  .com,hmac-md5-et
  00000430  6d 40 6f 70 65 6e 73 73 68 2e 63 6f 6d 00 00 00  [email protected]...
  00000440  1a 6e 6f 6e 65 2c 7a 6c 69 62 2c 7a 6c 69 62 40  .none,zlib,zlib@
  00000450  6f 70 65 6e 73 73 68 2e 63 6f 6d 00 00 00 1a 6e  openssh.com....n
  00000460  6f 6e 65 2c 7a 6c 69 62 2c 7a 6c 69 62 40 6f 70  one,zlib,zlib@op
  00000470  65 6e 73 73 68 2e 63 6f 6d 00 00 00 00 00 00 00  enssh.com.......
  00000480  00 00 00 00 00 00                                ......
Incoming packet #0x0, type 20 / 0x14 (SSH2_MSG_KEXINIT)
  00000000  4c ff 57 db 28 c7 a2 88 41 4d 12 04 be 5f 72 28  L.W.(...AM..._r(
  00000010  00 00 01 02 63 75 72 76 65 32 35 35 31 39 2d 73  ....curve25519-s
  00000020  68 61 32 35 36 2c 63 75 72 76 65 32 35 35 31 39  ha256,curve25519
  00000030  2d 73 68 61 32 35 36 40 6c 69 62 73 73 68 2e 6f  [email protected]
  00000040  72 67 2c 65 63 64 68 2d 73 68 61 32 2d 6e 69 73  rg,ecdh-sha2-nis
  00000050  74 70 32 35 36 2c 65 63 64 68 2d 73 68 61 32 2d  tp256,ecdh-sha2-
  00000060  6e 69 73 74 70 33 38 34 2c 65 63 64 68 2d 73 68  nistp384,ecdh-sh
  00000070  61 32 2d 6e 69 73 74 70 35 32 31 2c 64 69 66 66  a2-nistp521,diff
  00000080  69 65 2d 68 65 6c 6c 6d 61 6e 2d 67 72 6f 75 70  ie-hellman-group
  00000090  2d 65 78 63 68 61 6e 67 65 2d 73 68 61 32 35 36  -exchange-sha256
  000000a0  2c 64 69 66 66 69 65 2d 68 65 6c 6c 6d 61 6e 2d  ,diffie-hellman-
  000000b0  67 72 6f 75 70 31 36 2d 73 68 61 35 31 32 2c 64  group16-sha512,d
  000000c0  69 66 66 69 65 2d 68 65 6c 6c 6d 61 6e 2d 67 72  iffie-hellman-gr
  000000d0  6f 75 70 31 38 2d 73 68 61 35 31 32 2c 64 69 66  oup18-sha512,dif
  000000e0  66 69 65 2d 68 65 6c 6c 6d 61 6e 2d 67 72 6f 75  fie-hellman-grou
  000000f0  70 31 34 2d 73 68 61 32 35 36 2c 64 69 66 66 69  p14-sha256,diffi
  00000100  65 2d 68 65 6c 6c 6d 61 6e 2d 67 72 6f 75 70 31  e-hellman-group1
  00000110  34 2d 73 68 61 31 00 00 00 41 73 73 68 2d 72 73  4-sha1...Assh-rs
  00000120  61 2c 72 73 61 2d 73 68 61 32 2d 35 31 32 2c 72  a,rsa-sha2-512,r
  00000130  73 61 2d 73 68 61 32 2d 32 35 36 2c 65 63 64 73  sa-sha2-256,ecds
  00000140  61 2d 73 68 61 32 2d 6e 69 73 74 70 32 35 36 2c  a-sha2-nistp256,
  00000150  73 73 68 2d 65 64 32 35 35 31 39 00 00 00 6c 63  ssh-ed25519...lc
  00000160  68 61 63 68 61 32 30 2d 70 6f 6c 79 31 33 30 35  hacha20-poly1305
  00000170  40 6f 70 65 6e 73 73 68 2e 63 6f 6d 2c 61 65 73  @openssh.com,aes
  00000180  31 32 38 2d 63 74 72 2c 61 65 73 31 39 32 2d 63  128-ctr,aes192-c
  00000190  74 72 2c 61 65 73 32 35 36 2d 63 74 72 2c 61 65  tr,aes256-ctr,ae
  000001a0  73 31 32 38 2d 67 63 6d 40 6f 70 65 6e 73 73 68  s128-gcm@openssh
  000001b0  2e 63 6f 6d 2c 61 65 73 32 35 36 2d 67 63 6d 40  .com,aes256-gcm@
  000001c0  6f 70 65 6e 73 73 68 2e 63 6f 6d 00 00 00 6c 63  openssh.com...lc
  000001d0  68 61 63 68 61 32 30 2d 70 6f 6c 79 31 33 30 35  hacha20-poly1305
  000001e0  40 6f 70 65 6e 73 73 68 2e 63 6f 6d 2c 61 65 73  @openssh.com,aes
  000001f0  31 32 38 2d 63 74 72 2c 61 65 73 31 39 32 2d 63  128-ctr,aes192-c
  00000200  74 72 2c 61 65 73 32 35 36 2d 63 74 72 2c 61 65  tr,aes256-ctr,ae
  00000210  73 31 32 38 2d 67 63 6d 40 6f 70 65 6e 73 73 68  s128-gcm@openssh
  00000220  2e 63 6f 6d 2c 61 65 73 32 35 36 2d 67 63 6d 40  .com,aes256-gcm@
  00000230  6f 70 65 6e 73 73 68 2e 63 6f 6d 00 00 00 d5 75  openssh.com....u
  00000240  6d 61 63 2d 36 34 2d 65 74 6d 40 6f 70 65 6e 73  mac-64-etm@opens
  00000250  73 68 2e 63 6f 6d 2c 75 6d 61 63 2d 31 32 38 2d  sh.com,umac-128-
  00000260  65 74 6d 40 6f 70 65 6e 73 73 68 2e 63 6f 6d 2c  [email protected],
  00000270  68 6d 61 63 2d 73 68 61 32 2d 32 35 36 2d 65 74  hmac-sha2-256-et
  00000280  6d 40 6f 70 65 6e 73 73 68 2e 63 6f 6d 2c 68 6d  [email protected],hm
  00000290  61 63 2d 73 68 61 32 2d 35 31 32 2d 65 74 6d 40  ac-sha2-512-etm@
  000002a0  6f 70 65 6e 73 73 68 2e 63 6f 6d 2c 68 6d 61 63  openssh.com,hmac
  000002b0  2d 73 68 61 31 2d 65 74 6d 40 6f 70 65 6e 73 73  -sha1-etm@openss
  000002c0  68 2e 63 6f 6d 2c 75 6d 61 63 2d 36 34 40 6f 70  h.com,umac-64@op
  000002d0  65 6e 73 73 68 2e 63 6f 6d 2c 75 6d 61 63 2d 31  enssh.com,umac-1
  000002e0  32 38 40 6f 70 65 6e 73 73 68 2e 63 6f 6d 2c 68  [email protected],h
  000002f0  6d 61 63 2d 73 68 61 32 2d 32 35 36 2c 68 6d 61  mac-sha2-256,hma
  00000300  63 2d 73 68 61 32 2d 35 31 32 2c 68 6d 61 63 2d  c-sha2-512,hmac-
  00000310  73 68 61 31 00 00 00 d5 75 6d 61 63 2d 36 34 2d  sha1....umac-64-
  00000320  65 74 6d 40 6f 70 65 6e 73 73 68 2e 63 6f 6d 2c  [email protected],
  00000330  75 6d 61 63 2d 31 32 38 2d 65 74 6d 40 6f 70 65  umac-128-etm@ope
  00000340  6e 73 73 68 2e 63 6f 6d 2c 68 6d 61 63 2d 73 68  nssh.com,hmac-sh
  00000350  61 32 2d 32 35 36 2d 65 74 6d 40 6f 70 65 6e 73  a2-256-etm@opens
  00000360  73 68 2e 63 6f 6d 2c 68 6d 61 63 2d 73 68 61 32  sh.com,hmac-sha2
  00000370  2d 35 31 32 2d 65 74 6d 40 6f 70 65 6e 73 73 68  -512-etm@openssh
  00000380  2e 63 6f 6d 2c 68 6d 61 63 2d 73 68 61 31 2d 65  .com,hmac-sha1-e
  00000390  74 6d 40 6f 70 65 6e 73 73 68 2e 63 6f 6d 2c 75  [email protected],u
  000003a0  6d 61 63 2d 36 34 40 6f 70 65 6e 73 73 68 2e 63  [email protected]
  000003b0  6f 6d 2c 75 6d 61 63 2d 31 32 38 40 6f 70 65 6e  om,umac-128@open
  000003c0  73 73 68 2e 63 6f 6d 2c 68 6d 61 63 2d 73 68 61  ssh.com,hmac-sha
  000003d0  32 2d 32 35 36 2c 68 6d 61 63 2d 73 68 61 32 2d  2-256,hmac-sha2-
  000003e0  35 31 32 2c 68 6d 61 63 2d 73 68 61 31 00 00 00  512,hmac-sha1...
  000003f0  15 6e 6f 6e 65 2c 7a 6c 69 62 40 6f 70 65 6e 73  .none,zlib@opens
  00000400  73 68 2e 63 6f 6d 00 00 00 15 6e 6f 6e 65 2c 7a  sh.com....none,z
  00000410  6c 69 62 40 6f 70 65 6e 73 73 68 2e 63 6f 6d 00  [email protected].
  00000420  00 00 00 00 00 00 00 00 00 00 00 00              ............
Event Log: Doing ECDH key exchange with curve Curve25519 and hash SHA-256 (unaccelerated)
Outgoing packet #0x1, type 30 / 0x1e (SSH2_MSG_KEX_ECDH_INIT)
  00000000  00 00 00 20 78 d4 6f ef ea 7f c3 62 60 08 00 ad  ... x.o....b`...
  00000010  91 a2 73 d7 37 dd 58 a3 3b fe fd 1b 08 2b bc ba  ..s.7.X.;....+..
  00000020  65 6b 98 22                                      ek."
Incoming packet #0x1, type 31 / 0x1f (SSH2_MSG_KEX_ECDH_REPLY)
  00000000  00 00 00 33 00 00 00 0b 73 73 68 2d 65 64 32 35  ...3....ssh-ed25
  00000010  35 31 39 00 00 00 20 f5 2c e5 ef d9 23 c4 b9 5f  519... .,...#.._
  00000020  d5 76 1f 9f 79 4c e3 37 e8 d1 1a 35 89 49 82 54  .v..yL.7...5.I.T
  00000030  b2 3e 1d b3 02 6d 3f 00 00 00 20 ce b1 50 38 0c  .>...m?... ..P8.
  00000040  ea bb 7b 4e 58 55 d4 6a 92 2c a3 c2 85 b5 a9 d5  ..{NXU.j.,......
  00000050  77 fc 73 6a 80 26 95 4c 33 07 5f 00 00 00 53 00  w.sj.&.L3._...S.
  00000060  00 00 0b 73 73 68 2d 65 64 32 35 35 31 39 00 00  ...ssh-ed25519..
  00000070  00 40 0c c4 7a 03 36 1f 97 6c 3c c8 4c 15 4e 41  [email protected]<.L.NA
  00000080  39 e2 8b 51 e7 0f ba 93 af d0 43 73 2a 13 54 90  9..Q......Cs*.T.
  00000090  b1 d4 4d 19 78 c0 a1 8d 34 bc 71 16 fa 14 23 3a  ..M.x...4.q...#:
  000000a0  11 e3 f6 25 60 6e 8e d9 c0 fc e0 56 4f 8a 57 4c  ...%`n.....VO.WL
  000000b0  0f 0f                                            ..
Incoming packet #0x2, type 21 / 0x15 (SSH2_MSG_NEWKEYS)
Event Log: Server also has ecdsa-sha2-nistp256/ssh-rsa host keys, but we don't know any of them
Event Log: Host key fingerprint is:
Event Log: ssh-ed25519 255 b1:3f:8a:d8:03:a8:da:69:ae:9c:ba:75:ea:6f:ac:2f
Outgoing packet #0x2, type 21 / 0x15 (SSH2_MSG_NEWKEYS)
Event Log: Initialised AES-256 SDCTR (AES-NI accelerated) outbound encryption
Event Log: Initialised HMAC-SHA-256 (unaccelerated) outbound MAC algorithm
Event Log: Initialised AES-256 SDCTR (AES-NI accelerated) inbound encryption
Event Log: Initialised HMAC-SHA-256 (unaccelerated) inbound MAC algorithm
Outgoing packet #0x3, type 5 / 0x05 (SSH2_MSG_SERVICE_REQUEST)
  00000000  00 00 00 0c 73 73 68 2d 75 73 65 72 61 75 74 68  ....ssh-userauth
Incoming packet #0x3, type 6 / 0x06 (SSH2_MSG_SERVICE_ACCEPT)
  00000000  00 00 00 0c 73 73 68 2d 75 73 65 72 61 75 74 68  ....ssh-userauth
Event Log: Reading key file "C:\Users\claudemirsfj\Downloads\ubuntuKey.ppk"
Event Log: Pageant is running. Requesting keys.
Event Log: Pageant has 1 SSH-2 keys
Event Log: Configured key file not in Pageant
Outgoing packet #0x4, type 50 / 0x32 (SSH2_MSG_USERAUTH_REQUEST)
  00000000  00 00 00 06 75 62 75 6e 74 75 00 00 00 0e 73 73  ....ubuntu....ss
  00000010  68 2d 63 6f 6e 6e 65 63 74 69 6f 6e 00 00 00 04  h-connection....
  00000020  6e 6f 6e 65                                      none
Incoming packet #0x4, type 1 / 0x01 (SSH2_MSG_DISCONNECT)
  00000000  00 00 00 02 00 00 00 73 43 6f 6e 6e 65 63 74 69  .......sConnecti
  00000010  6f 6e 20 62 6c 6f 63 6b 65 64 20 62 65 63 61 75  on blocked becau
  00000020  73 65 20 73 65 72 76 65 72 20 6f 6e 6c 79 20 61  se server only a
  00000030  6c 6c 6f 77 73 20 70 75 62 6c 69 63 20 6b 65 79  llows public key
  00000040  20 61 75 74 68 65 6e 74 69 63 61 74 69 6f 6e 2e   authentication.
  00000050  20 50 6c 65 61 73 65 20 63 6f 6e 74 61 63 74 20   Please contact 
  00000060  79 6f 75 72 20 6e 65 74 77 6f 72 6b 20 61 64 6d  your network adm
  00000070  69 6e 69 73 74 72 61 74 6f 72 2e 00 00 00 00     inistrator.....
Event Log: Remote side sent disconnect message type 2 (protocol error): "Connection blocked because server only allows public key authentication. Please contact your network administrator."

我已经尝试过的:

  • 安全组向全世界开放(所有流量);
  • 用户名正确;
  • 密钥已从转换.pem.ppk
  • 转换的密钥是在 SSH > Auth 上设置的;
  • 我处于一个开放的网络上,没有任何限制;
  • 我也尝试过使用 mobaxterm(通过 GUI 和命令行)来使用.pem原始文件 - 同样的错误;

我在想,尝试了不同的 SSH 工具后,这可能是一些 EC2 配置细节......

我在托管项目时遇到了这个问题。有人能指导我找到解决方案吗?

谢谢!

答案1

在 Google 上搜索该错误消息,前两个相关结果都声称问题是由于防火墙上的 SSH 检查造成的。


这可以解释这种行为。虽然服务器声称是“OpenSSH”(实际服务器可能是 OpenSSH),但 OpenSSH 没有任何错误消息,例如“由于服务器仅允许公钥认证,连接被阻止。请联系您的网络管理员”。一定是某个代表真实 OpenSSH 服务器的中间服务器/设备注入了错误消息。

相关内容