Score:0

Cannot SSH on My EC2 Instance

us flag

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?

Tim avatar
gp flag
Tim
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
us flag
The problem is, the current setup doesn't have snapshot of the previous issue.
Tim avatar
gp flag
Tim
Then you probably best migrate your data to a new server.
Score:0
cn flag

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
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.