2

I'm using Amazon EC2 for Magento website and WinScp to access SFTP. Sometimes I'm using terminal in WinScp to execute command.

Today I need to delete some files so I used rm -R /* and forget to mention folder name.

Now i am unable to login using winscp to my server and the website is not working. I am getting this error in winscp:

"Authentication log (see session log for details):
Using username "ubuntu".
Server refused our key.

Authentication failed."

How can I login again and undo the massive erase?

  • I am fairly certain that you didn't use rm -R /* but rm -R *, or else you would have needed to use sudo and got a warning. – guntbert May 20 '15 at 9:25
  • When you can not login your instance is gone. – Rinzwind May 20 '15 at 9:28
  • @Rinzwind or he just deleted his ~/.ssh – guntbert May 20 '15 at 9:30
  • Sure ... but the general idea of an instance is that you have a way of connecting to it. If that method is deleted the instance is gone. No access is the same as deleting the instance from the main console panel. – Rinzwind May 20 '15 at 9:33
  • 1
    I am not an expert of EC2, but you probably need to recreate an instance and recover from a backup --- you deleted all you had permission to write to. – Rmano May 20 '15 at 10:01
2

You can recover the instance data by deploying your SSH key to a new copy of the instance, see e.g. https://stackoverflow.com/questions/3260739/add-keypair-to-existing-ec2-instance

  • Dude you are great. You just saved me. I have recovered my database using this method. attaching the link for the newbies and going to suffer in future stackoverflow.com/questions/10934745/… yeah but unable to recover my websites files. Files are deleted.. :( few one are left – Vaibhav Jain May 21 '15 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.