I am VERY new to EC2 here, and I have set up everything under the free tier today. So , I loginto my ec2 using (assuming default user ubuntu
):
ssh -i ~/.ssh/mykeypaid.pem ubuntu@<my ip address>
Now, I have edited my sudoers file as follows:
ubuntu ALL=(ALL:ALL) ALL
and then modified /etc/ssh/sshd_config
as follows:
Protocol 2
PermitRootLogin no
AuthorizedKeysFile %h/.ssh/authorized_keys
PermitEmptyPasswords no
PasswordAuthentication no
Now, when I try to ssh back in and try:
sudo su -
I get asked for an ubuntu password - which I do not really have. I have been trying to follow the instructions from here, but I am unsure what he means when he says:
Edit your ~/.ssh/authorized_keys and put your public key inside it. Make sure you can login without a password now once your key is in place.
what public key should I be including in ~/.ssh/authorized_keys? when I look at ~/.ssh/authorized_keys
I already see keys starting with
ssh-rsa .....
I would appreciate any advice to sort this. Now, I am not able to go back to the sudoers file - since it asks me for a password for ubuntu
which I think is strange(?)
Should I terminate my instance and start again? Thanks.