##Recovery Key ###
==create an instance with new pem key
==stop the actual instance
==detach the volume of actual instance
==attach the volume of actual instance to the new instance
==mount the volume (mount /dev/xvdf /mnt/recovery)
==copy new instance pem key to old instance volume
==umount the volume
==detach the old volume from the new instance
==attach the old volume to the old instance as (/dev/sda1)
==start the old instance
==login to the old instance with the recovery pem key
==How to know which Linux type you are running===
cat /etc/issue
3 fdisk -l
4 mkdir /mnt/recovery
5 mount /dev/xvdf /mnt/recovery/
6 cat /home/ubuntu/.ssh/authorized_keys for Amazon, Redhat cat /home/ec2-user/.ssh/authorized_keys
7 cat /home/ubuntu/.ssh/authorized_keys > /mnt/recovery/home/ubuntu/.ssh/authorized_keys for Amazon, Redhat cat /home/ec2-user/.ssh/authorized_keys > /mnt/recovery/home/ec2-user/.ssh/authorized_keys
8 more /mnt/recovery/home/ubuntu/.ssh/authorized_keys
9 df -h
10 umount /mnt/recovery
11 mount /dev/xvdf /mnt/recovery/
Note: Going forward the user can only login with the pem key.
Comments
Post a Comment