ubuntu - 使用 .pem 从 AWS Instance SSH 到 AWS Instance 要求输入密码

标签 ubuntu amazon-web-services ssh pem passphrase

我正在尝试 ssh/scp 进入我的 AWS 实例,但它总是要求 .pem 文件的密码,即使没有一组。我花了几个小时研究,我已经尝试了一切。它的 chmod'ed 400(也尝试了 600 和 777 - 不走运)

这是我在密码/密码上按 enter 后得到的:

  The authenticity of host '****************' can't be established.
    ECDSA key fingerprint is ************************.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '*********' (ECDSA) to the list of known hosts.
    Enter passphrase for key 'new_bro.pem':
    Permission denied (publickey).
    lost connection

这是一个 ssh -v 消息
ubuntu@ip-10-0-0-221:~$ ssh -v -i new_bro.pem ubuntu@***********
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to *************** port 22.
debug1: Connection established.
debug1: identity file new_bro.pem type -1
debug1: identity file new_bro.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA ***********************
debug1: Host '*************' is known and matches the ECDSA host key.
debug1: Found key in /home/ubuntu/.ssh/known_hosts:2
debug1: ssh_ecdsa_verify: signature correct
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
debug1: Next authentication method: publickey
debug1: Trying private key: new_bro.pem
debug1: key_parse_private2: missing begin marker
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key 'new_bro.pem':
debug1: No more authentication methods to try.
Permission denied (publickey).
ubuntu@ip-10-0-0-221:~$

我试过用不同的机器做这件事——同样的事情。将 .pem 转换为 .ppk 后,我可以使用 Putty 登录

请帮忙

最佳答案

您的 pem 文件已损坏,或者 pem key 的格式不正确

几个命令来测试它
openssl rsa -check -in new_bro.pem -noout应该说“RSA key ok”
ssh-keygen -y -e -f new_bro.pem从私钥生成公钥,与 Remote 上的公钥进行比较

关于ubuntu - 使用 .pem 从 AWS Instance SSH 到 AWS Instance 要求输入密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35362785/

相关文章:

c# - 获取跨平台系统健康 ASP.Net Core

ubuntu - 尝试安装 libopc、libxml2-dev 和 zlib1g-dev

amazon-web-services - Cloudformation 模板 Lambda 环境变量错误 - 属性变量的值必须是带有字符串的对象

ssh - Erlang客户端设置ssh key

azure - 如何在 Azure VM 中创建多个帐户?

ubuntu - 在 docker 容器中配置 sendmail

linux - 无法在 LAMP 中访问本地主机

emacs - 使用 ssh 配置的 emacs 中的 TRAMP 模式

amazon-web-services - 与客户端断开连接后如何检查在 amazon EMR 或 EC2 上运行的配置单元查询

amazon-web-services - 部署到 Lightsail 实例失败,因为找不到适合您的部署组的实例