Hello I used to login from my terminal to my ec2 istance using this command
ssh -i mypemfile.pem ec2-user@my-ipI have changed just the directory permission of my folder and and did this
sudo chmod -R 777 /home/ec2-user/Now when I try to login it says
Permission denied (publickey)Please help me how Can I go back. I am not able to login now
31 Answer
I'm not familiar is there a backdoor for amazon-ec2, but you should find a way to log-in into your server and change the permissions of the ~/.ssh directory and it's content as follow:
chmod go-w ~/
chmod 700 ~/.ssh
chmod 600 ~/.ssh/See the topic "Permission denied (publickey)" within the section "Troubleshooting" of the article Public and Private Keys on the Ubuntu Documentation Wiki.
If the password authentication is not already disabled you can try to log-in by the following command (source):
ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no user@host 4