-2

EDIT: The problem was that I was using a bad username (ec2-user) instead of "ubuntu". Sorry guys for wasting your time. :(

Question:

What happened:

I missmoved (-R) the /home of the EC2 to /var/www/html so when I tried to connect to ssh to this machine the connection was refused. I made It work again by moving it back again to /home and changing the permissions from /home/user/.ssh. But now the command scp refuses me:

Permission denied (publickey).

lost connection

So now I'm stucked here.

Things to know:

  • I have a kind of backup of the "/home" on "/var/www/html_what" on the EC2 instance.
  • I tried to change all permissions of the /home directory to match to another working EC2 instance.
  • I also changed the owner:group of each directory inside /home and /home (itself).

Thank you for reading!

Alberto
  • 101
  • 3

1 Answers1

0

This message is about not being able to authenticate using the public/private key mechanism. When connecting sucessfully through SSH, did you use password or public-key authentication ?

Also check for the permission mode for the .ssh folder and authorized_keys file. It should be 700 for .ssh and 600 for authorized_keys. Having wrong permission will prevent it from using the public key mechanism.

DevOps
  • 720
  • 5
  • 16
  • I'm connecting with a public key. And yes, I have the permissions that you are saying on the SSH directory and the authorized_keys – Alberto Oct 23 '17 at 15:19
  • keep in mind that I can connect by SSH but I get denied when I try to do an SCP. – Alberto Oct 23 '17 at 15:20
  • I can't upvote you but I would like to do it (your information that you provided is very important). Check the question edit please. Thank you for trying to help. – Alberto Oct 23 '17 at 15:33
  • I saw your issue. And yes, it is a pity that AMI are not using the same default user everywhere. I encountered so many in the past especially with AMI from the marketplace. – DevOps Oct 23 '17 at 15:36