I just did something really dumb and I'm wondering if there's any way to reverse it. So I have an AWS EC2 server instance and I was trying to edit the php.ini in /etc. It kept telling me that I didn't have permissions to write to it, so I just thought, "Okay, well nobody's ever really going to see this site, I'll just chmod everything." So I did chmod -R 750 ... I know... I know... What was I thinking. So now it messed everything up and I can't SSH in with my ec2-user login anymore... Is there any way to fix this or did I just permanently wreck it?
Asked
Active
Viewed 112 times
-1
-
1I guess you will have to restore from backup snapshot – lamirap Mar 28 '16 at 21:04
-
Do you have other active ssh sessions to that machine? The instance is still salvageable if the instance is EBS backed. – helloV Mar 28 '16 at 21:58
-
Please don't cross-post: http://superuser.com/questions/1058372/reset-linux-filesystem-permissions – Michael - sqlbot Mar 29 '16 at 02:11
1 Answers
1
If you are using an EBS backed instance, you can recover the SSH access doing this:
- Stop your crashed instance
- Detach the EBS root device
- Create a new instance
- Attach the EBS to the new instance and mount it in /mnt
- Fix your file permissions in /mnt/home/user/.ssh
- Unmount and detach the EBS
- Attach it to the crashed instance and start it
You should have ssh access, but note this won't fix all crashed files or directories. It only will give you ssh access, then you have to fix your files permissions. Otherwise, you do this in step 5.
Luck!

AGL
- 536
- 2
- 7