Password Recovery

1. Create a new instance

2. Detach the volume from the old instance

3. Attach the volume to the new instance (/dev/sdf)

4. Change the passwd of ec2-user on the new instance

passwd ec2-user

5. Copy the encrypted password of ec2-user

cat /etc/shadow

6. Mount the old instance’s volume

mkdir /mnt/ebs
mount /dev/sdf /mnt/ebs

7. Change the password of the old instance

chmod 777 /mnt/ebs/etc/shadow
vim /mnt/ebs/etc/shadow
chmod 000 /mnt/ebs/etc/shadow

8. Stop the new instance

9. Detach the old volume from the new instance and then attach it to the old instance (/dev/sda1)

10. Terminate the new instance