Fix a corrupted RSA key on an Amazon

  1. The machine must be EBS based.
  2. Create a new t1.micro instance in the same availability zone as the affected machine with a new Tag name but pointing to same key pair as the affected machine is pointed to.
  3. Stop the affected machine (do not terminate) – this is only possible with EBS machines)
  4. Detach the EBS volume from the affected machine (by default attached as /dev/sda1)
  5. Attach the detached EBS device to the new machine at location (e.g. /dev/sda2)
  6. SSH into the new machine using putty and mount the affected machine’s root filesystem (/dev/sda2) to somewhere (e.g. in /mnt/fs) and edit the authorized_keys file at location /mnt/fs/sda2/root/.ssh/authorized_keys  for root or /home/user/.ssh/authorized_keys for user  and add your existing key-pair public key to it.

Command to mount affected machine’s root file system to new machine’s /mnt directory:

mount /dev/sda2 /mnt/fs

cd /mnt/fs/root/.ssh

vi authorized_keys

  1. Once changes are done, unmount the affected volume. Stop the new machine, detach the volume from it and terminate the new machine.

Command to unmount:

umount /mnt/fs

  1. Re-attach the affected device to the affected machine (which is already stopped) – ensure to attach it as the same device it was before (e.g. /dev/sda1)
  2. Re-start your old machine. ssh to the machine and you should be able to use your old machine.

You can also view other big data tutorials here.

Related articles

Advertisements

About Sharmistha Chakraborty

Sharmistha is currently working as a Big Data Architect with Accenture concentrating on distributed computing areas with focus on Hadoop and its eco system and NOSQL data store. Her job includes understanding business needs, performing complex analysis on huge volume of unstructured, structured and poly structured data, exploring the pattern of data and deriving intelligence out of data to accelerate the pace of innovation. She is also involved in defining and designing execution architecture, build big data solution platform for different industry aligned clients.
This entry was posted in Uncategorized and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s