0

My last activity was I accidentically edited permission on my ec2 instace

I was trying to add permission 775 on my project's directory called storage

command like this

sudo chmod -R 775 storage

But instead doing this on /var/www/html/ I did this on directory like this ~ means the root directory.

and I exit the terminal and tried to access the server using ssh but it gaves me an error

Connection time out port 22

The following steps I tried to fix but didn't work on my end

  1. Adding Public IP to Security Group using SSH Port 22
  2. Adding rule to Network ACL ( for both inbound and outbound rules ) enter image description here enter image description here
  3. Checking Route table enter image description here
  4. Tried to Snapshot the Instance and launch new ec2 instance using same AMI

all the above steps are what I tried, but still I cannot connect. Is there missing step that I need to do?

Pablo
  • 255
  • 1
  • 4
  • 11
  • 1
    Restore from snapshot taken previous to this issue would be my suggestion. Fixing it would be a nightmare. You'd probably be better off setting up a new server and migrating data than trying to fix it – Tim Jul 06 '21 at 23:03
  • The problem is, the current setup doesn't have snapshot of the previous issue. – Pablo Jul 07 '21 at 00:09
  • 1
    Then you probably best migrate your data to a new server. – Tim Jul 07 '21 at 01:15

1 Answers1

0

Try login with Session Manager.

Create an ec2 service role with "AmazonEC2RoleforSSM" policy attached. Assign that role to your VM or if an existing role is attached to VM then add above policy to it.

Wait for 5-10 mins and then SSH via SSM. Steps for it are:

  • select your VM in EC2 page, click connect in top right
  • on next page select session manager and click connect
dy10
  • 41
  • 5