-1

Here is what I did:

client: => generated 2 keys with ssh-keygen -t rsa

=> sent id_rsa.pub to server (with scp) and put it to ~/.ssh/authorized_keys

Server: in /etc/ssh/shd_config:

=> uncommented AuthorizedKeysFile %h/.ssh/authorized_keys

=> PasswordAuthentication no

=> UsePAM no

And I restarted the server: service sshd restart

Problem: when I try to connect "ssh user@IP_Server -v" and after I've put my passphrase.

I get the following logs:

Enter passphrase for key '/root/.ssh/id_rsa':
debug3: sign_and_send_pubkey: RSA SHA256:HMjzNl/zNrs...3m6SYDQ64ZoHeL6k
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug1: Trying private key: /root/.ssh/id_dsa
debug3: no such identity: /root/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /root/.ssh/id_ecdsa
debug3: no such identity: /root/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /root/.ssh/id_ed25519
debug3: no such identity: /root/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).

Do you have any idea where this logs comes from ?

Cheers

mric750
  • 183
  • 8
  • `Trying private key: /root/.ssh/id_dsa debug3: no such identity: /root/.ssh/id_dsa: No such file or directory` This is what you need to check. Check private key path – Hrabosch Sep 12 '16 at 10:20
  • @Hrabosch There is no id_dsa indeed, but it's because I've put only id_rsa in /root/.ssh, and I just want to use rsa keys... – mric750 Sep 12 '16 at 10:23
  • @Hrabosch I don't understand why openssh continue to look for other keys – mric750 Sep 12 '16 at 10:24
  • Try to look at ssh/config and check `IdentityFile`, what is there? – Hrabosch Sep 12 '16 at 10:29
  • It's all uncommented both sides – mric750 Sep 12 '16 at 10:37
  • something strange is in sshd_config HostKey is set to /etc/ssh/ssh_host_rsa_key maybe I should change it to the path to id_rsa.pub ? – mric750 Sep 12 '16 at 10:39
  • Apparently there are 2 places to put the public key on the server, either ~/.ssh/authorized_keys either /etc/ssh, which one should I use ? – mric750 Sep 12 '16 at 10:44
  • `ssh_host_rsa_key — The RSA private key used by the sshd daemon for version 2 of the SSH protocol.` and `id_rsa.pub — The RSA public key*used by ssh for version 2 of the SSH protocol`, one is for public and next is for private! :) – Hrabosch Sep 12 '16 at 11:27
  • Use `authorized_keys` to keep public keys. – Hrabosch Sep 12 '16 at 11:28
  • https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/3/html/Reference_Guide/s1-ssh-configfiles.html for more informations to clarify – Hrabosch Sep 12 '16 at 11:29

1 Answers1

0

Ok, I thought that authorized_keys was a Directory, and put the public Key in it. But actually it's a file ! Solved !

mric750
  • 183
  • 8