Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I accidentally change the permission to chmod -R 777 /var and now I cannot access the EC2 instance how do I fix this?

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

Loosing access to an Amazon EC2 instance is a common encounter - how to approach this situation when you don't know the reason yet is addressed in Eric Hammond's excellent summary Solving: "I can't connect to my server on Amazon EC2". However, since you already now what caused this, you can apply his respective instructions Fixing Files on the Root EBS Volume of an EC2 Instance right away, which boils down to:

[Note: this only applies to instances with Amazon EBS based Root Device Storage, because only these can be stopped without loosing the root volume; put another way, take care not to terminate your instance instead ;)]

  • start another EC2 instance
  • stop the EC2 instance you can't access anymore
  • detach the EBS volume from the stopped instance
  • attach the EBS volume to the running instance
  • SSH into the running instance
  • mount the EBS volume in the running instance
  • perform whatever fixes necessary, i.e. adjust the /var permissions in your case

Please see Eric's instructions for details on how to do this from the command line; obviously you can achieve all steps up to the SSH access via the AWS Management Console as well, removing the need to install the Amazon EC2 API Tools, in case they aren't readily available already.

Good luck!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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