I have access to the console panel for EC2. There exists one key pair (created by someone prior).
I created a second key-pair, and then tried to SSH
in to the ec2 instance. This is what happens:
PREMIEREs-Mac-Pro:.ssh Premier_032$ ssh -i ~/.ssh/david.pem [email protected]
Permission denied (publickey).
What do I need to do in order to SSH
to EC2 here, and is ubuntu
the correct username (I also tried root
, which didn't work either).
Adding a keypair to EC2 doesn't add it to running instances. EC2 only installs keypairs when an instance is launched. You'll need to obtain the keypair used to launch the instance, or have whoever launched it add your public key to the
/home/ubuntu/.ssh/authorized_keys
file.I'm pretty sure a running instance isn't going to install a new public SSH key you added to the account. You'll need to start up a new instance and then select the keys you want to use to access it.
It's hard to say what the username will be. It would depend on the AMI.
If you need to access that specific instance there is possibly a workaround to your situation. You will need access to the AWS Web Console and the instance will need to be a EBS backend instance. What you will need to do is;
You should now have access to the file system of the old instance. Navigate the the user account you want to log in as, assuming ubuntu from your post, and add your new ssh key to the .ssh/authorized_keys file (path should be /mnt/oldsystem/home/ubuntu/.ssh/authorized_keys)
Once you are done, unmount /mnt/oldsystem and de-attach the EBS backend. Now you can re-attach the EBS to your original instance, start the instance up, and you should be able to use your SSH key to log into the account now.