0

I have installed Ubuntu Amazon ec2 instance and got the following error:

First I use ppk key and ubuntu as username and I was able to login to my system and I use sudo su command to get root access (without any password) there were no problem, then I made the following change in file /etc/sudoers

#add line 
Ubuntu ALL=(ALL) ALL

Now when I connect using ssh it get connected, but when I use sudo su command it ask password but I have no idea what the password is how to solve this?

(I think it will give root privileges and I don't need to use sudo command each time when I run apt-get update and apt-get upgrade, but now I can not access my root account.

1 Answer 1

0

What happened

Case matters. If your account name is ubuntu, and you gave permission to Ubuntu, then you are stuck.

It looks like you locked your self out.

A solution

The easiest solution is (probably) to delete the instance, and create a new one.

A more complex solution (partial)

If you will loose data if you do this. Then there will be ways to mount the file-system on another OS instance, edit the config-file, and then re-try. (if this is the case, then update question to tell us.)

1
  • Assuming AWS exposes the system console, it may be possible to boot to single user mode. Potential blockers on this route are if grub is locked down with a password and/or the system requires the root password for SUM.
    – bxm
    Feb 19, 2020 at 10:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .