0

Here is the issue

  • Created a new server with Amazon Linux 2
  • Removed ssh-key from default root user (ec2-user)
  • Created two new accounts with sudo access without a password

Now I got locked out of the root access in this server, anytime I run a 'sudo' command the OS is asking for a password. But during user creation I never set any password. Additionally, passwd is asking for the current password.

Anything I can do, except start again?

3
  • 1
    You can shut the instance down, attach and mount its root volume on a different instance, and reset the passwords. If you aren't far along with the instance, its easier to delete it and start over. Commented Mar 23, 2020 at 18:49
  • ended reseting the server since it was a fresh new one anyhow with no data
    – asosnovsky
    Commented Mar 24, 2020 at 14:10
  • You can't have a root user without a password on any modern Linux once you removed the SSH key you didn't replace the password an account with a null and as a result you could no longer get In. It may also be that local passwords for disabled and once you removed the SSH key you lost it. Doing this doesn't seem to be any type of good practice. Commented Mar 26, 2020 at 20:25

0

You must log in to answer this question.

Browse other questions tagged .