SSH ключът не работи при нова инсталация на Linux

Наскоро преинсталирах моята операционна система (Mint 17.1) и исках да използвам моите ssh ключове, за да се свържа с git. Използвал съм този ключ на много места без проблеми досега. Има много отговори по този въпрос, но никой от тях не ми помогна досега.

.ssh директория има 0700 разрешения

Така че резултатът, който получавам, е следният:

ssh -vT [email protected]
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/herod/.ssh/config
debug1: /home/herod/.ssh/config line 1: Applying options for *
debug1: /home/herod/.ssh/config line 9: Applying options for github.com
debug1: /home/herod/.ssh/config line 14: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [192.30.252.128] port 22.
debug1: Connection established.
debug1: identity file /home/herod/.ssh/xxxx/id_rsa.pub type 1
debug1: identity file /home/herod/.ssh/xxxx/id_rsa.pub-cert type -1
debug1: identity file /home/herod/.ssh/xxxx2222/id_rsa.pub type 1
debug1: identity file /home/herod/.ssh/xxxx2222/id_rsa.pub-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: Remote protocol version 2.0, remote software version libssh-0.6.0
debug1: no match: libssh-0.6.0
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/herod/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
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: /home/herod/.ssh/xxxx/id_rsa.pub
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: key_parse_private2: missing begin marker
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/herod/.ssh/xxxx/id_rsa.pub': 
debug1: key_parse_private2: missing begin marker
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>

person Herr Nentu'    schedule 01.05.2015    source източник
comment
key_parse_private_pem: PEM_read_PrivateKey failed изглежда, че не сте копирали правилно личния си ключ. Опитайте да го копирате отново   -  person number5    schedule 01.05.2015
comment
debug1: identity file /home/herod/.ssh/xxxx/id_rsa.pub type 1 Изглежда, че сте казали на ssh да използва грешен ключов файл. Вижте stackoverflow.com/a/29948797/13317   -  person Kenster    schedule 01.05.2015
comment
@Kenster, какво ще стане, ако настройката ми е такава: Host github.com User USER Hostname github.com PreferredAuthentications publickey IdentityFile ~/.ssh/xxxx/id_rsa.pub   -  person Herr Nentu'    schedule 01.05.2015


Отговори (1)


Това проработи за мен (отговорът е взет от тук):

„За мен, тъй като самият ключ беше криптиран, следвах следните стъпки:

Стартирайте ssh-агент:

$ ssh-агент bash

Добавете стандартен ключ за самоличност към мениджъра на ключове:

$ ssh-добавяне

Ако искате да добавите различен ключ, тогава:

$ ssh-добавяне /локация/на/ключ

За да проверите по всяко време списъка с текущо заредени ключове:

$ ssh-add -l Повече подробности можете да получите от този връзка"

Като добавка към коментара @Kenster и към решението тук, когато добавите ключа, ще трябва да добавите частния ключ

$ ssh-add /location/of/key (ex ssh-add .ssh/folder/id_rsa)

и не

$ ssh-add /location/of/key.pub (ex ssh-add .ssh/folder/id_rsa.pub)

person Herr Nentu'    schedule 01.05.2015