本文翻译自:Permission denied (publickey) when SSH Access to Amazon EC2 instance [closed]
I want to use my Amazon ec2 instance but faced the following error: 我想使用我的Amazon ec2实例,但遇到以下错误:
Permission denied (publickey).
I have created my key pair and downloaded .pem file. 我创建了密钥对并下载了.pem文件。
Given: 鉴于:
chmod 600 pem file.
Then, this command 然后,这个命令
ssh -i /home/kashif/serverkey.pem ubuntu@ec2-54-227-242-179.compute-1.amazonaws.com
But have this error: 但有这个错误:
Permission denied (publickey)
Also, how can I connect with filezilla to upload/download files? 另外, 如何连接filezilla上传/下载文件?
#1楼
参考:https://stackoom.com/question/1Fq6e/SSH访问Amazon-EC-实例时权限被拒绝-publickey-关闭
#2楼
This error message means you failed to authenticate. 此错误消息表示您无法进行身份验证。
These are common reasons that can cause that: 这些是导致这种情况的常见原因:
- Trying to connect with the wrong key. 试图用错误的密钥连接。 Are you sure this instance is using this keypair? 你确定这个实例正在使用这个密钥对吗?
- Trying to connect with the wrong username. 试图用错误的用户名连接。
ubuntu
is the username for the ubuntu based AWS distribution, but on some others it'sec2-user
(oradmin
on some Debians, according to Bogdan Kulbida's answer)(can also beroot
,fedora
, see below)ubuntu
是基于ubuntu的AWS发行版的用户名,但是对于其他一些ec2-user
来说,它是ec2-user