Ключ 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 Имя хоста 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 (например, ssh-add .ssh/folder/id_rsa)

и нет

$ ssh-add /location/of/key.pub (например, ssh-add .ssh/folder/id_rsa.pub)

person Herr Nentu'    schedule 01.05.2015