[gelöst] SSH-Verbindung und priv/pub key funktioniert nicht

Einrichten des lokalen Netzes, Verbindung zu anderen Computern und Diensten.
Antworten
SaFl
Beiträge: 6
Registriert: 16.02.2017 14:28:36

[gelöst] SSH-Verbindung und priv/pub key funktioniert nicht

Beitrag von SaFl » 16.02.2017 14:43:04

Moin Moin liebe Gemeinde,

mein erster Beitrag und mein erstes Mal hier. Erstmal einen schönen Gruß aus dem hohen Norden.

Ich beschäftige mich zur Zeit sehr intensiv mit Debian und Servern.
Grundsätzlich habe ich keine Probleme bei der generellen Benutzung und Verwaltung, jedoch verstehe ich nicht, warum die Sache mit dem key nicht funktionieren will.

Ich habe mir bestimmt 10 Anleitungen angesehen, die alle ja das gleiche sagen und habe das ganze schon x-mal ausprobiert. Ich habe den key angelegt und in ./ssh/authorized_keys eingetragen. In der Config steht die RSA-Authentication auf yes und PubkeyAuthentication auch auf yes. Soweit so gut. Den Pfad zu den Keys ist hier mit .ssh/aut... angegeben. Habe auch schon ~/ und %h/ ausprobiert. Ohne Erfolg. Nach dem restart des ssh-service kann ich mich nur ganz normal per Passwort anmelden. Habe ich generell irgendwas übersehen und vergessen?

Wenn ihr noch weitere Infos benötigt, sagt bescheid, versuche so gut ich kann euch entgegen zukommen.

Achja, auch die Suche in dem Forum und überhaupt im Internet haben mich nicht weiter gebracht. Habt also bitte ein wenig Verständnis.

Vielen Dank, Thomas
Zuletzt geändert von SaFl am 18.02.2017 07:36:44, insgesamt 1-mal geändert.

mat6937
Beiträge: 2953
Registriert: 09.12.2014 10:44:00

Re: SSH-Verbindung und private/publik key funktioniert nicht

Beitrag von mat6937 » 16.02.2017 14:58:34

SaFl hat geschrieben: Wenn ihr noch weitere Infos benötigt, sagt bescheid, versuche so gut ich kann ...
Schreibe in die config des Clienten:

Code: Alles auswählen

 PasswordAuthentication no
und poste danach die Ausgaben von:

Code: Alles auswählen

ssh -vvv <user>@<IP-Adresse-Server>
(oder gleichwertig).

SaFl
Beiträge: 6
Registriert: 16.02.2017 14:28:36

Re: SSH-Verbindung und private/publik key funktioniert nicht

Beitrag von SaFl » 16.02.2017 15:03:49

mat6937 hat geschrieben:
Schreibe in die config des Clienten:

Code: Alles auswählen

 PasswordAuthentication no
Sperre ich mich damit nicht selbst aus?

SaFl
Beiträge: 6
Registriert: 16.02.2017 14:28:36

Re: SSH-Verbindung und private/publik key funktioniert nicht

Beitrag von SaFl » 16.02.2017 15:19:00

Code: Alles auswählen

OpenSSH_6.7p1 Debian-5+deb8u3, OpenSSL 1.0.1t  3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to xxx.xxx.xxx.xx [xxx.xxx.xxx.xx] port 51333.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/bob/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bob/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bob/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bob/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bob/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bob/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bob/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bob/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u3
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.7p1 Debian-5+deb8u3
debug1: match: OpenSSH_6.7p1 Debian-5+deb8u3 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug3: put_host_port: [xxx.xxx.xxx.xx]:51333
debug3: load_hostkeys: loading entries for host "[xxx.xxx.xxx.xx]:51333" from file "/home/bob/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/bob/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-ed25519,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: setup umac-64-etm@openssh.com
debug1: kex: server->client aes128-ctr umac-64-etm@openssh.com none
debug2: mac_setup: setup umac-64-etm@openssh.com
debug1: kex: client->server aes128-ctr umac-64-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 77:d6:32:7f:0c:54:6c:2f:24:60:8b:bd:e5:1d:37:4a
debug3: put_host_port: [xxx.xxx.xxx.xx]:51333
debug3: put_host_port: [xxx.xxx.xxx.xx]:51333
debug3: load_hostkeys: loading entries for host "[xxx.xxx.xxx.xx]:51333" from file "/home/bob/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/bob/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys
debug3: load_hostkeys: loading entries for host "[xxx.xxx.xxx.xx]:51333" from file "/home/bob/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/bob/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys
debug1: Host '[xxx.xxx.xxx.xx]:51333' is known and matches the ECDSA host key.
debug1: Found key in /home/bob/.ssh/known_hosts:1
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/bob/.ssh/id_rsa ((nil)),
debug2: key: /home/bob/.ssh/id_dsa ((nil)),
debug2: key: /home/bob/.ssh/id_ecdsa ((nil)),
debug2: key: /home/bob/.ssh/id_ed25519 ((nil)),
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/bob/.ssh/id_rsa
debug3: no such identity: /home/bob/.ssh/id_rsa: No such file or directory
debug1: Trying private key: /home/bob/.ssh/id_dsa
debug3: no such identity: /home/bob/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/bob/.ssh/id_ecdsa
debug3: no such identity: /home/bob/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/bob/.ssh/id_ed25519
debug3: no such identity: /home/bob/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
Hab Passwort mal drin gelassen, bevor ich noch nen Fehler mache.

Benutzeravatar
Dogge
Beiträge: 1895
Registriert: 13.09.2010 11:07:33
Lizenz eigener Beiträge: MIT Lizenz

Re: SSH-Verbindung und private/publik key funktioniert nicht

Beitrag von Dogge » 16.02.2017 16:33:55

debug1: Trying private key: /home/bob/.ssh/id_rsa
debug3: no such identity: /home/bob/.ssh/id_rsa: No such file or directory
debug1: Trying private key: /home/bob/.ssh/id_dsa
debug3: no such identity: /home/bob/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/bob/.ssh/id_ecdsa
debug3: no such identity: /home/bob/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/bob/.ssh/id_ed25519
debug3: no such identity: /home/bob/.ssh/id_ed25519: No such file or directory

Dein private key wird nicht gefunden.

Du hast deinen key auf der Maschine bob erstellt und den xyz.pub auf den Server kopiert?
Debian Testing + Gnome | Linux-Anfänger seit 04/2003
http://files.mdosch.de/2014-07/0xE13D657D.asc

SaFl
Beiträge: 6
Registriert: 16.02.2017 14:28:36

Re: SSH-Verbindung und private/publik key funktioniert nicht

Beitrag von SaFl » 18.02.2017 07:32:16

Moin,
sorry dass ich dich so lange hab warten lassen.
Nein, ich habe den Key "offline" auf meinem Windows Rechner erstellt. "bob" ist hier der Server.

Habe den priate-Key allerdings noch nicht in MobaXTerm eingebunden. Muss ich das etwa? Ich bin bisher davon ausgegangen, dass ich dann ein Promp bekomme dass ich einen Key angeben soll...

SaFl
Beiträge: 6
Registriert: 16.02.2017 14:28:36

Re: SSH-Verbindung und private/publik key funktioniert nicht

Beitrag von SaFl » 18.02.2017 07:36:02

Okay, ich habe nun den Key in MobaXterm eingebunden und nun gehts. Hätte ich nicht gedacht, aber man lernt ja nie aus.
Danke für die Hilfe und einen schönes Wochenende

mat6937
Beiträge: 2953
Registriert: 09.12.2014 10:44:00

Re: SSH-Verbindung und private/publik key funktioniert nicht

Beitrag von mat6937 » 18.02.2017 10:12:15

SaFl hat geschrieben:
mat6937 hat geschrieben:
Schreibe in die config des Clienten:

Code: Alles auswählen

 PasswordAuthentication no
Sperre ich mich damit nicht selbst aus?
Nein, Du sperrst dich nicht aus, denn Du machst diese Änderung auf deinem Client (so wie ich geschrieben habe) und nicht auf deinem Server. Und auf dem (Linux-)Client kannst Du diese Änderung jederzeit (... d. h. auch dann, wenn keine Verbindung zustande kommt bzw. nicht möglich ist) rückgängig machen.
SaFl hat geschrieben: ... ich habe den Key "offline" auf meinem Windows Rechner erstellt. "bob" ist hier der Server.
Aber ich sehe gerade, Du hast ja gar keinen Linux-Client. Auf welchem Gerät hast Du dann "ssh -vvv <user>@<ip-adresse> ausgeführt? Wäre gut gewesen, wenn Du in deinem 1. Beitrag geschrieben hättest, dass der Client, Windows als OS hat.

SaFl
Beiträge: 6
Registriert: 16.02.2017 14:28:36

Re: [gelöst] SSH-Verbindung und priv/pub key funktioniert ni

Beitrag von SaFl » 18.02.2017 12:06:46

Achso, sorry dafür. Ich habe den "ssh -vvv" auf dem Server ausgeführt, von Konsole zu Konsole

Antworten