Unable to login to EC2 ubuntu server due to permission issue.
Issue: My EC2 ubuntu server has (root & ubuntu) user and I use to login to ubuntu using ssh. By mistake I have changed the ownership of Ubuntu home directory to root and also revoked all permission from the directory for other user. So user (Ubuntu) home directory has only RWX permission for root and no one else. Now I am not able to login using SSH to ubuntu. I provided .pem file but this time I am getting password prompt irrespective of .pem file. Seems I messed up.
What I tried:
- Tried to login to root using ssh (Didn't allowed)
- Tried to login to ubuntu using ssh (Asking password because the permission issue I believe)
- Tried hacking in. Was running Wordpress so I put shell over server using Admin. I got reverse shell but unable to do privilege escalation to get root.
I will really appreciate if you can help me to get in my server/reset password/way to get in from AWS Dashboard/or any way.