1

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

1 Answer 1

5

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!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .