Home > ssh > Can't seem to SSH into AWS EC2 instance, ssh permission denied error

Can't seem to SSH into AWS EC2 instance, ssh permission denied error

October 1Hits:4
Advertisement

I've launched a new EC2 instance with AWS using Amazon 64 bit linux (amzn-ami-2011.09.1.x86_64-ebs (ami-20506254)) and I'm having trouble ssh-ing into it. I've generated a public/private ssh keypair using ssh-keygen -t rsa and added the .pub (public) key to my key-pairs in the EC2 management console.

When I attempt to run: ssh -i ~/.ssh/aws_ec2 -v ec2-46-137-17-221.eu-west-1.compute.amazonaws.com

I get the following output:

    OpenSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011 debug1: Reading configuration data /Users/casey/.ssh/config debug1: Reading configuration data /etc/ssh_config debug1: Connecting to ec2-79-125-85-42.eu-west-1.compute.amazonaws.com [79.125.85.42] port 22. debug1: Connection established. debug1: identity file /Users/casey/.ssh/aws_ec2 type 1 debug1: identity file /Users/casey/.ssh/id_rsa type 1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 debug1: match: OpenSSH_5.3 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.2 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'ec2-79-125-85-42.eu-west-1.compute.amazonaws.com' is known and matches the RSA host key. debug1: Found key in /Users/casey/.ssh/known_hosts:8 debug1: ssh_rsa_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: Offering public key: /Users/casey/.ssh/id_rsa debug1: Authentications that can continue: publickey debug1: Offering public key: /Users/casey/.ssh/aws_ec2 debug1: Authentications that can continue: publickey debug1: No more authentication methods to try. Permission denied (publickey). 

Not sure what's going on since it does offer my ssh private key but appears to just get denied. Anyone know what's going on?

Answers

I figured it out:

ssh -i ~/.ssh/aws_ec2 -v [email protected]

You need to use ec2-user as the username.

Related Articles

  • Can't seem to SSH into AWS EC2 instance, ssh permission denied errorOctober 1

    I've launched a new EC2 instance with AWS using Amazon 64 bit linux (amzn-ami-2011.09.1.x86_64-ebs (ami-20506254)) and I'm having trouble ssh-ing into it. I've generated a public/private ssh keypair using ssh-keygen -t rsa and added the .pub (public)

  • why can't I ssh into my aws ec2 instance? Permission denied (publickey)August 14

    I created two ec2 instances, and was able to ssh into the first two fine. After creating the third, I get this error upon trying to ssh into any of them. This is what I'm running: ssh -v -i /Users/name/meteor.pem [email protected]### To get: OpenSSH_

  • ssh into AWS EC2 instance with botocmdshellJanuary 19

    I have a cluster on AWS that I want to SSH into with boto.cmdshell. however maybe I'm not understanding the parameters to pass. The node has the user ubuntu and no passphrase set. ssh_client = sshclient_from_instance(instanceobj, ssh_key_file =r'C:\U

  • aws ssh timeout for ec2 instanceFebruary 5

    I'm trying to ssh into my ec2 instance, but I get a timeout. When I try and ping the server I get No route to host. Visiting the IP address in my browser brings up the webpage with no issue. My security group is set-up like so HTTP - TCP - 80 - 0.0.0

  • how to change password of AWS EC2 instanceAugust 3

    I am logging in my AWS EC2 instance using winscp/putty as root using a .ppk file which has imported-openssh-key. Earlier it was shared with many ppl, who are all gone, so now I have to change it in such a way that no one else can access it. I tried t

  • The disk that shows up on AWS EC2 instance - where is it coming from (among the AWS EBS volumes)?June 20

    I have a running AWS EC2 instance (Ubuntu 12.04.4 LTS). When I ssh into that instance and do a 'df -h', I see the following: Filesystem Size Used Avail Use% Mounted on /dev/xvda1 99G 75G 19G 80% / udev 1.9G 8.0K 1.9G 1% /dev tmpfs 378M 172K 378M 1% /

  • adding 2nd private IP on AWS EC2 instanceJuly 16

    I am having problems adding a 2nd IP on AWS EC2 instance. I am running Ubuntu 14.04. I already tried this: a) Right clicked the instance and added a 'private IP' from the manage Private IP. b) Ssh'ed into the machine and added a file /etc/network/int

  • How to get rid of firewall blockage to ssh to my ec2 instance August 26

    I've made my ec2 instance on AWS and I worked on it at home like a charm and everything went fine (connection wise) Today I went to the library and when I tried to ssh into my ec2 using PuTTy as I always do, the connect can't be made and I'm given th

  • Deleting a Key Pair for AWS EC2 Instance with EBSSeptember 3

    I have an AWS EC2 Instance using EBS and I want to stop the use of the current private key, and use a new one. As I understand it, merely deleting the key pair on the AWS Console just deletes the public key and does not prevent access to the instance

  • Trying to connect to AWS RDS from an AWS EC2 instanceOctober 23

    I am trying to connect to an AWS RDS instance from an AWS EC2 instance. I ssh into the AWS EC2 instance, and then issue the following command: mysql -h xxxxxx.ciy4oapkpytm.us-east-1.rds.amazonaws.com -P 3306 -u root -p and when I enter my password, I

  • Rebooting AWS EC2 instance not coming back online

    Rebooting AWS EC2 instance not coming back onlineDecember 23

    About 40 minutes ago, I restarted my AWS EC2 instance using the admin panel. A moment later, the instance state was "running" again, and the status checks continued to pass. After about 20 minutes, though, the phpMyAdmin panel is refusing to loa

  • Logging into an AWS EC2 instance from another machine in EC2February 24

    I have a few AWS EC2 instances that can SSH into each other. They are not in a VPC as this is an older AWS account and was active before VPC. One particular EC2 instance (zeta) is not able to SSH into another particular instance which hosts our publi

  • Change the root EBS device of AWS EC2 instanceMay 2

    I changed the root device of my AWS ec2 instance and now I can't log in, I get: Permission denied (publickey) The new ebs I changed to was also a bootable volume. Then I created another instance and added the root volume of the first instance as a se

  • why can't I view my app on my aws ec2 instance? deployed with meteor upAugust 13

    I'm trying to get my meteor app up onto an aws ec2 instance using meteor up. This worked for me previously, following this tutorial. I've successfully run mup setup and mup deploy, but when I try to access the app through the Public DNS, I get Google

  • How do you properly forward Domain name from 1and1 to an AWS EC2 instance

    How do you properly forward Domain name from 1and1 to an AWS EC2 instanceJanuary 26

    I have been attempting to forward my domain EmblemsOnDemand.com which is managed on 1and1.com to an AWS EC2 instance (Prestashop Lamp Stack) however when I do so the domain name forwards to the EC2 instance however the name resolves as ec2-52-34-87-2

  • Unable to install Dynamics CRM2011 on AWS EC2 instanceJuly 23

    I'm attempting to install Dynamics CRM 2011 on an AWS EC2 instance (Server 2008 R2 64 bit) When I run Microsoft.Crm.Server.Setup.exe from the Server\amd64 folder on the installation CD I get a message telling me the .exe is not a valid Win32 applicat

  • Is it possible to merge multiple AWS EC2 instances?November 24

    I'm getting a reserved AWS EC2 instance. but i'm worried that if i invest in it upfront and need to upgrade i wouldn't be able to. In fact i would but i won't get my money back for the rest of the terminated instance. Can i make multiple EC2 instance

  • Cannot SSH into Amazon EC2 instanceJuly 9

    I read: Cannot connect to ec2 instance http://stackoverflow.com/questions/5635640/cannot-ssh-into-amazon-ec2-instance Amazon EC2 instance ssh problems etc... But could not fix it: suddenly (after a year of service, no changes on my winscp settings) i

  • Exception while running Selenium on AWS EC2 instanceAugust 24

    I am facing this exception when I run a Selenium test case using the Firefox driver on the AWS EC2 instance which is the headless server. I installed Firefox and all the necessary changes for it org.openqa.selenium.WebDriverException: org.openqa.sele

  • How to prevent/firewall calls to AWS EC2 Instance Metadata API?October 8

    The AWS EC2 Instance Metadata API provides a lot of useful functionality. Anyone on the actual EC2 instance can make a call to http://169.254.169.254/ and see metadata for the instance the call was made from. The security of the API is such that it o

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.737 s.