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?
Asked
Active
Viewed 91 times
2
John M.
- 143
- 4
-
Your question is a duplicate of this one: [*SSH without sourcing `.bashrc`*](https://superuser.com/q/1585162/432690), unless EC2 provides a way to fix things without SSH. I know nothing about EC2 so I cannot tell. – Kamil Maciorowski Feb 22 '21 at 20:29
-
@KamilMaciorowski Thanks for pointing out the link. I guess there is no obvious solution there? – John M. Feb 22 '21 at 21:41
-
Cross-post of https://unix.stackexchange.com/q/635893/203203 – xhienne Feb 23 '21 at 00:39
1 Answers
2
You need to:
- Create another EC2 instance, or use another EC2 instance you have in your VPC,
- Detach the EBS from the faulty EC2 instance,
- Attach this EBS (as a secondary drive) into the EC2 instance you created in step 1.
- Fix the issues you have on your files,
- 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,471
- 9
- 10