1

I've got a terrible problem on a running webserver. It's a webserver running on CentOS, one of the default Amazon EC2 AMI's (images). I've been able to ssh to the server and do my thing until now. After a 'yum update' a sudo command from the ssh user (the standard user 'ec2-user') needs a password. I can't find a way to perform sudo operations now, and I can't find the default password either. I've never changed the password, so it should be the default value.

Does anyone now the default password, or a solution? SSH'ing as root does not work.

Keugels
  • 121
  • 1
  • 2

1 Answers1

2

You'll need to do an offline recovery. The steps are roughly:

  1. Shut down the server.
  2. Start up another temporary instance.
  3. Detach the EBS disk from the original server and attach it to the temporary server.
  4. Mount the filesystem.
  5. Edit /etc/shadow and copy/paste a known password hash into the ec2-user's entry.
  6. Unmount and detach from temporary server.
  7. Re-attach EBS volume to original instance.
  8. Start up original instance.

Once you complete those steps, you should be able to sudo using the password that corresponds with the password hash you pasted in.

EEAA
  • 109,363
  • 18
  • 175
  • 245