staging.inyokaproject.org

SSH Public Key Authentication scheitert

Status: Gelöst | Ubuntu-Version: Ubuntu 20.10 (Groovy Gorilla)
Antworten |

Kabuntel

Anmeldungsdatum:
1. Januar 2018

Beiträge: 49

Hallo Community,

leider bekomme ich kein ssh Zugang mit Public Key zustande. Ich dachte vielleicht wirft jemand ein Blick auf mich.

Ich habe soweit mit ssh-keygen und ssh-copy-id die Voraussetzung geschafft. Nur jedes mal wenn ich mich verbinden will, kommt eine Passwortabfrage.

Hier mal der output mit ssh -v;

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
ssh -v osboxes@192.168.43.61
OpenSSH_8.3p1 Ubuntu-1, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 192.168.43.61 [192.168.43.61] port 22.
debug1: Connection established.
debug1: identity file /home/osboxes/.ssh/id_rsa type -1
debug1: identity file /home/osboxes/.ssh/id_rsa-cert type -1
debug1: identity file /home/osboxes/.ssh/id_dsa type -1
debug1: identity file /home/osboxes/.ssh/id_dsa-cert type -1
debug1: identity file /home/osboxes/.ssh/id_ecdsa type -1
debug1: identity file /home/osboxes/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/osboxes/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/osboxes/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/osboxes/.ssh/id_ed25519 type -1
debug1: identity file /home/osboxes/.ssh/id_ed25519-cert type -1
debug1: identity file /home/osboxes/.ssh/id_ed25519_sk type -1
debug1: identity file /home/osboxes/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/osboxes/.ssh/id_xmss type -1
debug1: identity file /home/osboxes/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.3p1 Ubuntu-1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to 192.168.43.61:22 as 'osboxes'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:6PxfARN2W5eOhP2MGyyB1EES0fSM7uIjhsxMOWt0Zbk
debug1: Host '192.168.43.61' is known and matches the ECDSA host key.
debug1: Found key in /home/osboxes/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/osboxes/.ssh/id_rsa 
debug1: Will attempt key: /home/osboxes/.ssh/id_dsa 
debug1: Will attempt key: /home/osboxes/.ssh/id_ecdsa 
debug1: Will attempt key: /home/osboxes/.ssh/id_ecdsa_sk 
debug1: Will attempt key: /home/osboxes/.ssh/id_ed25519 
debug1: Will attempt key: /home/osboxes/.ssh/id_ed25519_sk 
debug1: Will attempt key: /home/osboxes/.ssh/id_xmss 
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)


debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)


debug1: Next authentication method: publickey
debug1: Trying private key: /home/osboxes/.ssh/id_rsa
debug1: Trying private key: /home/osboxes/.ssh/id_dsa
debug1: Trying private key: /home/osboxes/.ssh/id_ecdsa
debug1: Trying private key: /home/osboxes/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/osboxes/.ssh/id_ed25519
debug1: Trying private key: /home/osboxes/.ssh/id_ed25519_sk
debug1: Trying private key: /home/osboxes/.ssh/id_xmss
debug1: Next authentication method: password
osboxes@192.168.43.61's password: 

Der remote host ein centos 7 core und der ssh-Server ein OpenSSH

sebix Team-Icon

Ehemalige

Anmeldungsdatum:
14. April 2009

Beiträge: 5584

Klappt es, wenn du den zu verwendenden SSH-Key mit -i (bzw in der .ssh/config) explizit anbgibst?

Doc_Symbiosis

Avatar von Doc_Symbiosis

Anmeldungsdatum:
11. Oktober 2006

Beiträge: 4453

Hm, es sieht für mich so aus, als würde es mit keinem der Schlüssel funktionieren.

Welches ssh-copyid hast Du genau ausgeführt und ist bei dem Server auch Pubkey-Authentifizierung zugelassen?

Kabuntel

(Themenstarter)

Anmeldungsdatum:
1. Januar 2018

Beiträge: 49

@Doc_Symbiosis Ich habe ssh-copy-id -i t.pub root@ipserver verwendet Auf dem remote server ist im file authorized_keys der key enthalten

@sebix: Mit ssh -i t.pub osboxes@ipserver klappt auch nicht. Wo genau kann ich den key und in welcher config datei von ssh hinterlegen???

Und danke für eure Hilfestellung

Kabuntel

(Themenstarter)

Anmeldungsdatum:
1. Januar 2018

Beiträge: 49

PubKeyAuthentication ist auf yes

Into_the_Pit Team-Icon

Ehemalige
Avatar von Into_the_Pit

Anmeldungsdatum:
25. Juni 2008

Beiträge: 9490

Kabuntel schrieb:

@sebix: Mit ssh -i t.pub osboxes@ipserver klappt auch nicht.

Zeige mal bitte vom Client ein

ls -l ~/.ssh

Wo genau kann ich den key und in welcher config datei von ssh hinterlegen???

Auf dem Ziel sollte Dein User eine ~/.ssh/authorized_keys Datei haben, dort sollte der Inhalt Deines pubkeys drin sein. Einfach mittels cat prüfen, ob die identisch sind.

Doc_Symbiosis

Avatar von Doc_Symbiosis

Anmeldungsdatum:
11. Oktober 2006

Beiträge: 4453

Also in .ssh müsste eine Datei t und eine Datei t.pub vorhanden sein (deine beiden Schlüssel).

Achso, und hinter dem -i musst Du den privaten Schlüssel angeben (also den ohne die Endung .pub)

sebix Team-Icon

Ehemalige

Anmeldungsdatum:
14. April 2009

Beiträge: 5584

Doc_Symbiosis schrieb:

Achso, und hinter dem -i musst Du den privaten Schlüssel angeben (also den ohne die Endung .pub)

AFAIK ist ssh so intelligent und sucht sich selbst den privaten Schluessel.

Aber wenn du t.pub angibts, dann wird t.pub im aktuellen Verzeichnis gesucht! Dort sucht ssh sicher nicht automatisch nach Keys, also verschieb den am besten nach ~/.ssh und setze ihn explizit in deiner SSH Config.

Kabuntel

(Themenstarter)

Anmeldungsdatum:
1. Januar 2018

Beiträge: 49

Hab jetzt es hinbekommen. Ich habe einfach ssh-keygen laufen lassen und explizit keinen Namen gegeben. Dann hat er mir auch gleich die beiden keys unter .ssh/ gelegt.

Nochmal ein großes Dankeschön für eure Posts!

grüße, kabuntel

Antworten |