0

I'm trying to copy the public key to my remote host but I keep getting this message, "Permission denied (public key).

enter image description here

Password authentication is set to YES in my /etc/ssh/sshd_config file, I have started again from scratch with these commands :

$ssh-keygen -t rsa $ chmod 700 ~/.ssh $ chmod 600 ~/.ssh/id_rsa $ cat id_rsa.pub >> ~/.ssh/authorized_keys $ chmod 600 ~/.ssh/authorized_keys 

Anybody can help me with this please ?

6
  • Have you checked the manpage of ssh-copy-id, how it tries to install the public key on the new host? Commented Mar 6, 2016 at 16:05
  • Yes I did! but still I keep having the same issue, I dont know what I'm missing here ! Commented Mar 6, 2016 at 16:11
  • You can't use publickey auth because the key isn't there yet. You need to enable password once, after that you can disable that again. Commented Mar 6, 2016 at 16:19
  • 1
    Please do not post screenshots of text. Copy-paste the text. Commented Mar 6, 2016 at 16:28
  • Additionally (to the comment by ott), you need to specify the user for whom the key shall be added '[email protected]' Commented Mar 6, 2016 at 16:29

1 Answer 1

0

You miss a basic point in what you do. You need to make sure what is server, what is client and what you want to achieve.

  • You generate the keys on client (your computer)
  • You set up server using sshd_config and you want to have authorized_keys on the server (that IP in the image).

If you did the above, you are able to restart sshd server using service sshd restart and connect to localhost, such as ssh localhost.

If you want to connect somewhere else (as the above IP), you need to allow the password authentication and restart there (and not on your host). Or to transfer the key by different channel, but ssh-copy-id will not help with that.

1
  • 1
    You are a life saving, thanks a lot, the only thing what I missed is that I had to set Password authentication to YES in the server not in my client! Thank a lot ! Commented Mar 6, 2016 at 17:25

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.