1
I am a total AWS and SSH newbie so please bear with me. I am trying to ensure that I can make a perfect duplicate of an EC2 instance before proceeding with risky installations that may ruin important dependencies. I created an AMI of instance "A" and launched it as instance "B". Both A and B are Ubuntu 16.04. In the AWS console, instructions to connect SSH to instance B differ from instructions of instance A. More specifically, I connect to instance A using:
ssh -i "keypair.pem" ubuntu@instanceA.amazonaws.com
but for instance B, amazon suggests:
ssh -i "keypair.pem" root@instanceB.amazonaws.com
the important difference being root vs. ubuntu. SSH login to instance A works fine but not to instance B. When connecting as root, I receive a message saying Please login as the user "ubuntu" rather than the user "root" and cannot get in. When connecting as ubuntu, I receive a message saying Permission denied (publickey). Any idea?
When you launched B from the AMI, you needed to specify which keypair to use. Did you? If you didn't, that does not necessarily mean the one used on A will still work. The username will be the same. Not sure where you see a suggestion of using
root
, but that's almost certainly incorrect. – Michael - sqlbot – 2017-10-08T21:34:35.087and, you can see what keypair was used on launch via the EC2 link from aws dashboard, then click the box next to your instance and see all the details. – strobelight – 2017-10-08T21:51:30.417
I tried both selecting the same key as instance A and creating a new key, both with the same results. The suggestion comes when I click on "connect" selecting instance B. this is where the auto-generated ssh command appears with root as user. – Vlad – 2017-10-09T00:54:19.143
Are you sure you selected the right key pair ? http://strimas.com/img/rstudio-cloud/kp-select.png
– Algeriassic – 2017-10-09T14:47:12.067yes I'm 100% sure. – Vlad – 2017-10-09T16:44:42.303