I have scoured the Internet for answers and had little luck. All I have been trying to do is connect to my AWS EC2 Linux server via SSH.
The.pem file is on my computer, but it has not been accepted. I have tried several FTP clients, including FileZilla and the native Terminal on my Mac.
In FileZilla, my error is the following:
Error:Disconnected: No supported authentication methods available (server sent: public key)
I also have encountered a similar message in Terminal:
Warning: Identity file rejectedFile.pem not accessible: No such file or directory. Permission denied (publickey).
I have quadruple-checked the file name corresponds to the one in the AWS console. This file was downloaded when I initialized the instance…
Advertisement
Answer
I’d suggest you check also these two common mistakes:
- Wrong permissions of the .pem file: make sure the file exists with proper permissions (chmod 400)
- Default username: use the proper username for your linux distro
Use the ssh command to connect to the instance. You’ll specify the private key (.pem) file and user_name@public_dns_name. For Amazon Linux, the user name is ec2-user. For RHEL5, the user name is either root or ec2-user. For Ubuntu, the user name is ubuntu. For Fedora, the user name is either fedora or ec2-user. For SUSE Linux, the user name is root. Otherwise, if ec2-user and root don’t work, check with your AMI provider.
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html