2

I mistakenly have source .bash_profile in the bashrc file and vice versa. Now when I tried to ssh into the machine (ec2), it will stuck at loading bash and get connection closed in a second. Is there a way I could fix it? Could I mount the disk to another ec2 instance to fix the bash files?

John M.
  • 143

1 Answers1

2

You need to:

  1. Create another EC2 instance, or use another EC2 instance you have in your VPC,
  2. Detach the EBS from the faulty EC2 instance,
  3. Attach this EBS (as a secondary drive) into the EC2 instance you created in step 1.
  4. Fix the issues you have on your files,
  5. Detach it again from this instance and attach it to the "original" EC2 instance

You shold be able to restore access to your EC2 instance.

Algeriassic
  • 1,719
  • 11
  • 10