我有一个EC2 Linux服务器,它在子网a中拥有公共IP,除此之外,我还在子网b中创建了另一台EC2服务器,它具有私有IP。两台服务器都在同一个VPC中。我想从公共服务器ssh到私人服务器。 SSH端口在服务器的安全组设置上打开。但我否认设置从公共服务器到私有服务器-EC2的SSH连接?
[[email protected] ~]$ ssh [email protected]
The authenticity of host '10.0.20.71 (10.0.20.71)' can't be established.
RSA key fingerprint is 11:19:79:39:a3:04:d2:23:5e:af:9e:c6:98:9c:7b:bd.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.20.71' (RSA) to the list of known hosts.
Permission denied (publickey).
我相信权限(公网IP),我需要私人服务器的公钥加入到公共服务器弄好了。但我不知道它的正确方法,如果我错过了其他一些设置。
我已经使用Google搜索,但找不到一个直接的方法来解决这个问题。
更新时间:
如果我使用添加剂,则只能从我的电脑我可以ssh到专用服务器,如果有就需要ssh到专用服务器更多的用户,都需要做代理转发所以我不确定这是否是这种情况的最佳方式。如果我想要连接到公共服务器时使用密钥,那么在没有使用密钥的情况下ssh到私有服务器会怎么样。像:
ssh [email protected]
一个答案:可以使用默认密钥位置。
Setting the default ssh key location
您是否使用相同的密钥对启动了两台服务器? – helloV
@helloV没有钥匙对不同 – Matrix