Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

(I'm very inexperienced with servers)

After getting frustrated with some permission issues on my AWS EC2 instance I decided I would do the command:

chmod -R 777 /

I thought that would change the permissions of the folder I was in, but it seems to have affected every file on my server instance. As a result, I can no longer SSH into the server. It simply says connection failed.

The only image of the server I took was from way too long ago and doesn't have the files I want.

Is there a way I can simply download the files I want from the AWS console, and then from there just upload them to a new instance?


The reason that I can no longer login is because the key pair (as well as several other files) cannot be found with the new 777 permissions, thus preventing me from logging in.

This is however, not my question. My question is how to get these files.

share|improve this question

marked as duplicate by Michael Hampton Jul 16 '13 at 3:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I have to disagree that this is a duplicate. It's only incidentally about destructive chmod. It's actually about "I hosed my server and can't get back in, how do I recover my files". Perhaps we should be creating a new question for this (or finding one that answers it to link to)? – ianjs Jul 16 '13 at 1:57
Several mods have marked this question as a duplicate (under false grounds, possibly without actually reading the question). This without any explanation or help in understanding the (ostensible) violation under which this question is to be closed. They could further differentiate this question from the "duplicate" question via the edit feature, or they could allow for one vaguely similar question, or they could explain in any detail at all how this question violates any terms or address me personally as I am an actual human being who can be contacted. You know, something actually helpful. – Kevin Beal Jul 16 '13 at 2:41
Dealing with such arbitrary moderation makes me resent how useful these sites actually are. Maybe it's worth it, but it sure is a pain in the fucking ass sometimes. – Kevin Beal Jul 16 '13 at 2:47
No, it's not a duplicate of that particular question, though I'm sure you'll find it interesting reading. It's a duplicate of a completely different question :) – Michael Hampton Jul 16 '13 at 3:09
@MichaelHampton Thank you for that. It was helpful and relevant. I appreciate that sort of moderation. Take care! – Kevin Beal Jul 16 '13 at 3:16
up vote 5 down vote accepted

See this question for why your system was hosed.

This question duplicates Re-gaining root access to an EC2 EBS-boot image and all of this will only work for an EBS boot instance, not Instance Store boot, but to summarise:

  1. Stop (don't terminate) the server from the AWS console.
  2. Detach its root EBS volume.
  3. Start another ec2 instance in the same zone as the root EBS volume.
  4. Attach the EBS volume from step(2) to the ec2 instance in step(3).
  5. Mount the EBS volume from the instance of step(3).

You should be able to see all your files this way.

share|improve this answer
Thanks for getting back to me. I'm in step 4 and the volume from step 2 doesn't show the second ec2 instance in the dropdown of available instances. It only shows the first instance that has the problem. I'll keep working at it, but if you can help with that specifically, that would be totally awesome. – Kevin Beal Jul 13 '13 at 23:52
I'm assuming that you did a stop of the original server not a terminate as `terminate will most likely clean up by deleting the root volume (@Daniel t probably should have emphasised this). Did you start up the instance in the same region? You can't attach volumes across regions. – ianjs Jul 14 '13 at 1:29
Thanks @ianjs. The new instance you have launched has to be in the same region as your old instance. DO NOT terminate the original ec2 instance, especially if it is an instance-store. – Daniel t. Jul 14 '13 at 4:13
The first new instance was in the wrong region, but the second one I made just now was in the same region (us-west-1b) and it also didn't show up in the dropdown for available instances (under "attach instance" option). – Kevin Beal Jul 14 '13 at 5:12
Sorry, while I said the instance has to be in the same region, I should have mentioned it has to be in the same zone as well - you can't attach a volume to an instance across zones either. If the volume is also in us-west-1b then it should work. Otherwise start an instance in us-west-1b and you should be ok. – ianjs Jul 16 '13 at 3:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.