2017-02-27 4 views
1

ssh bietet immer noch den falschen SSH-Schlüssel zum SSH-Server.SSH - bietet immer noch den falschen SSH-Schlüssel

Hier ist, was ich versucht habe:

ssh -T -i ~/.ssh/my_new_id_rsa [email protected] -v 

und in .ssh/config

Host my-new-host 
Hostname github.com 
IdentityFile ~/.ssh/my_new_id_rsa 
User git 

Die Ausgabe von ssh -T ist:

ssh -T -i ~/.ssh/my_new_id_rsa [email protected] -v 
OpenSSH_6.9p1, LibreSSL 2.1.8 
debug1: Reading configuration data /Users/snowcrash/.ssh/config 
debug1: /Users/snowcrash/.ssh/config line 18: Applying options for my-new-host 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 21: Applying options for * 
debug1: /etc/ssh/ssh_config line 56: Applying options for * 
debug1: Connecting to github.com [192.30.253.113] port 22. 
debug1: Connection established. 
debug1: identity file /Users/snowcrash/.ssh/my_new_id_rsa type 1 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/snowcrash/.ssh/my_new_id_rsa-cert type -1 
debug1: identity file /Users/snowcrash/.ssh/id_rsa type 1 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/snowcrash/.ssh/id_rsa-cert type -1 
debug1: identity file /Users/snowcrash/.ssh/my_new_id_rsa type 1 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/snowcrash/.ssh/my_new_id_rsa-cert type -1 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_6.9 
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0 
debug1: no match: libssh-0.7.0 
debug1: Authenticating to github.com:22 as 'git' 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client [email protected] <implicit> none 
debug1: kex: client->server [email protected] <implicit> none 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8 
debug1: Host 'github.com' is known and matches the RSA host key. 
debug1: Found key in /Users/snowcrash/.ssh/known_hosts:91 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey 
debug1: Next authentication method: publickey 
debug1: Offering RSA public key: /Users/snowcrash/.ssh/id_rsa 
debug1: Server accepts key: pkalg ssh-rsa blen 279 
debug1: Authentication succeeded (publickey). 
Authenticated to github.com ([192.30.253.113]:22). 
debug1: channel 0: new [client-session] 
debug1: Entering interactive session. 
debug1: Sending environment. 
debug1: Sending env LANG = en_US.UTF-8 
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 
Hi abraxor! You've successfully authenticated, but GitHub does not provide shell access. 
debug1: channel 0: free: client-session, nchannels 1 
Transferred: sent 3252, received 1776 bytes, in 0.3 seconds 
Bytes per second: sent 12550.5, received 6854.1 
debug1: Exit status 1 

Alles, was mit debug1: key_load_public: No such file or directory zu tun?

Wenn es hilft /Users/snowcrash/.ssh/my_new_id_rsa und /Users/snowcrash/.ssh/my_new_id_rsa.pub existieren.

und mit zusätzlichen Debugging:

ssh -T [email protected] -i ~/.ssh/my_new_id_rsa -vvv 
OpenSSH_6.9p1, LibreSSL 2.1.8 
debug1: Reading configuration data /Users/snowcrash/.ssh/config 
debug1: /Users/snowcrash/.ssh/config line 18: Applying options for my-new-host 
debug1: /Users/snowcrash/.ssh/config line 23: Applying options for * 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 21: Applying options for * 
debug1: /etc/ssh/ssh_config line 56: Applying options for * 
debug2: ssh_connect: needpriv 0 
debug1: Connecting to github.com [192.30.253.112] port 22. 
debug1: Connection established. 
debug1: identity file /Users/snowcrash/.ssh/my_new_id_rsa type 1 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/snowcrash/.ssh/my_new_id_rsa-cert type -1 
debug1: identity file /Users/snowcrash/.ssh/id_rsa type 1 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/snowcrash/.ssh/id_rsa-cert type -1 
debug1: identity file /Users/snowcrash/.ssh/my_new_id_rsa type 1 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/snowcrash/.ssh/my_new_id_rsa-cert type -1 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_6.9 
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0 
debug1: no match: libssh-0.7.0 
debug2: fd 5 setting O_NONBLOCK 
debug1: Authenticating to github.com:22 as 'git' 
debug3: hostkeys_foreach: reading file "/Users/snowcrash/.ssh/known_hosts" 
debug3: record_hostkey: found key type RSA in file /Users/snowcrash/.ssh/known_hosts:91 
debug3: load_hostkeys: loaded 1 keys from github.com 
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],ssh-rsa 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug2: kex_parse_kexinit: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 
debug2: kex_parse_kexinit: [email protected],[email protected],ssh-rsa,[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-dss 
debug2: kex_parse_kexinit: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
debug2: kex_parse_kexinit: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected]om,[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1,[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1,[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
debug2: kex_parse_kexinit: none,[email protected],zlib 
debug2: kex_parse_kexinit: none,[email protected],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: [email protected],ecdh-sha2-nistp256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 
debug2: kex_parse_kexinit: ssh-dss,ssh-rsa 
debug2: kex_parse_kexinit: [email protected],aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc 
debug2: kex_parse_kexinit: [email protected],aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc 
debug2: kex_parse_kexinit: hmac-sha1,hmac-sha2-256,hmac-sha2-512 
debug2: kex_parse_kexinit: hmac-sha1,hmac-sha2-256,hmac-sha2-512 
debug2: kex_parse_kexinit: none,zlib,[email protected] 
debug2: kex_parse_kexinit: none,zlib,[email protected] 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug1: kex: server->client [email protected] <implicit> none 
debug1: kex: client->server [email protected] <implicit> none 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8 
debug3: hostkeys_foreach: reading file "/Users/snowcrash/.ssh/known_hosts" 
debug3: record_hostkey: found key type RSA in file /Users/snowcrash/.ssh/known_hosts:91 
debug3: load_hostkeys: loaded 1 keys from github.com 
debug3: hostkeys_foreach: reading file "/Users/snowcrash/.ssh/known_hosts" 
debug3: record_hostkey: found key type RSA in file /Users/snowcrash/.ssh/known_hosts:67 
debug3: load_hostkeys: loaded 1 keys from 192.30.253.112 
debug1: Host 'github.com' is known and matches the RSA host key. 
debug1: Found key in /Users/snowcrash/.ssh/known_hosts:91 
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: /Users/snowcrash/.ssh/id_rsa (0x7faca240dac0), explicit 
debug2: key: /Users/snowcrash/.ssh/my_new_id_rsa (0x7faca26012c0), explicit 
debug2: key: /Users/snowcrash/.ssh/my_new_id_rsa (0x7faca240d310), explicit 
debug1: Authentications that can continue: publickey 
debug3: start over, passed a different list publickey 
debug3: preferred 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: Offering RSA public key: /Users/snowcrash/.ssh/id_rsa 
debug3: send_pubkey_test 
debug2: we sent a publickey packet, wait for reply 
debug1: Server accepts key: pkalg ssh-rsa blen 279 
debug2: input_userauth_pk_ok: fp SHA256:tiBoG7eFalMe2h9TvaqSIFWhMzwCldzENxN3fwdUQ+Q 
debug3: sign_and_send_pubkey: RSA SHA256:tiBoG7eFalMe2h9TvaqSIFWhMzwCldzENxN3fwdUQ+Q 
debug1: Authentication succeeded (publickey). 
Authenticated to github.com ([192.30.253.112]:22). 
debug1: channel 0: new [client-session] 
debug3: ssh_session2_open: channel_new: 0 
debug2: channel 0: send open 
debug1: Entering interactive session. 
debug2: callback start 
debug2: fd 5 setting TCP_NODELAY 
debug3: ssh_packet_set_tos: set IP_TOS 0x08 
debug2: client_session2_setup: id 0 
debug1: Sending environment. 
debug3: Ignored env AUTOJUMP_ERROR_PATH 
debug3: Ignored env rvm_bin_path 
debug3: Ignored env TERM_PROGRAM 
debug3: Ignored env AUTOJUMP_SOURCED 
debug3: Ignored env GEM_HOME 
debug3: Ignored env SHELL 
debug3: Ignored env TERM 
debug3: Ignored env IRBRC 
debug3: Ignored env TMPDIR 
debug3: Ignored env Apple_PubSub_Socket_Render 
debug3: Ignored env TERM_PROGRAM_VERSION 
debug3: Ignored env OLDPWD 
debug3: Ignored env MY_RUBY_HOME 
debug3: Ignored env TERM_SESSION_ID 
debug3: Ignored env USER 
debug3: Ignored env _system_type 
debug3: Ignored env rvm_path 
debug3: Ignored env SSH_AUTH_SOCK 
debug3: Ignored env __CF_USER_TEXT_ENCODING 
debug3: Ignored env rvm_prefix 
debug3: Ignored env PATH 
debug3: Ignored env PWD 
debug1: Sending env LANG = en_US.UTF-8 
debug2: channel 0: request env confirm 0 
debug3: Ignored env _system_arch 
debug3: Ignored env XPC_FLAGS 
debug3: Ignored env _system_version 
debug3: Ignored env XPC_SERVICE_NAME 
debug3: Ignored env FIGNORE 
debug3: Ignored env rvm_version 
debug3: Ignored env SHLVL 
debug3: Ignored env HOME 
debug3: Ignored env LOGNAME 
debug3: Ignored env GEM_PATH 
debug3: Ignored env DISPLAY 
debug3: Ignored env RUBY_VERSION 
debug3: Ignored env _system_name 
debug3: Ignored env _ 
debug2: channel 0: request shell confirm 1 
debug2: callback done 
debug2: channel 0: open confirm rwindow 32000 rmax 35000 
debug2: channel_input_status_confirm: type 99 id 0 
debug2: shell request accepted on channel 0 
debug2: channel 0: rcvd ext data 89 
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 
debug2: channel 0: rcvd eof 
debug2: channel 0: output open -> drain 
debug2: channel 0: rcvd close 
debug2: channel 0: close_read 
debug2: channel 0: input open -> closed 
debug3: channel 0: will not send data after close 
debug2: channel 0: obuf_empty delayed efd 9/(89) 
Hi <wrong user>! You've successfully authenticated, but GitHub does not provide shell access. 
debug2: channel 0: written 89 to efd 9 
debug3: channel 0: will not send data after close 
debug2: channel 0: obuf empty 
debug2: channel 0: close_write 
debug2: channel 0: output drain -> closed 
debug2: channel 0: almost dead 
debug2: channel 0: gc: notify user 
debug2: channel 0: gc: user detached 
debug2: channel 0: send close 
debug2: channel 0: is dead 
debug2: channel 0: garbage collecting 
debug1: channel 0: free: client-session, nchannels 1 
debug3: channel 0: status: The following connections are open: 
    #0 client-session (t4 r43 i3/0 o3/0 fd -1/-1 cc -1) 

Transferred: sent 3252, received 1776 bytes, in 0.8 seconds 
Bytes per second: sent 4064.8, received 2219.9 
debug1: Exit status 1 

==== UPDATE 1

Mein ~/.ssh/config

Host * IdentitiesOnly ja

==== UPDATE 2

enthält

Wenn ichausführenund rm id_rsa* dann bietet es den richtigen ssh-Schlüssel an.

+0

Haben Sie noch etwas in Ihrer '~/.ssh/config' oder'/etc/ssh/ssh_config'? Wenn ja, kannst du deine config nach '~/.ssh/config2' kopieren, entferne alles außer den oben erwähnten Zeilen und versuche' ssh -F ~/.ssh/config2 ... '? –

+0

Ich habe 'IdentityFile ~/.ssh/id_rsa' an der Spitze in einer eigenen Zeile. Dann 'Host my-new-host Hostname github.com IdentityFile ~/.ssh/my_new_id_rsa Benutzer git '. Sieht so aus, als würde diese kahle Linie an der Spitze alles andere vielleicht außer Kraft setzen? – Snowcrash

+0

Ja, das ist das Problem. 'IdentityFile' ist eine Liste von Optionen. Alle Übereinstimmungen werden in einer Liste zusammengefasst und dann der Reihe nach versucht. Siehe [ssh_config-Manpage] (https://linux.die.net/man/5/ssh_config), wo es heißt: ** Es ist möglich, mehrere Identitätsdateien in den Konfigurationsdateien anzugeben; Alle diese Identitäten werden der Reihe nach ausprobiert **. Was verwirrend ist, ist, dass vorne gesagt wird, dass die Befehlszeile Vorrang hat, was offensichtlich nicht der Fall ist ... –

Antwort

0

Die ssh bietet standardmäßig die Schlüssel an den Standardpositionen. Wenn Sie dieses Verhalten ändern möchten, müssen Sie IdentitiesOnly yes Option in Ihrem ssh_config verwenden.

+0

Ich hatte das - siehe UPDATE. – Snowcrash

+0

Was enthält alle Ihre Konfigurationsdateien? – Jakuje

Verwandte Themen