Я настроил ssh-ключ и хочу подключиться к localhost, используя только ключ, без пароля (примечание: это всего лишь тест; в конечном итоге я хочу подключиться к внутреннему git-серверу, где возникает та же проблема). Вот вывод команды ssh -v localhost

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/myusername/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/myusername/.ssh/id_rsa type 1
debug1: identity file /home/myusername/.ssh/id_rsa-cert type -1
debug1: identity file /home/myusername/.ssh/id_dsa type -1
debug1: identity file /home/myusername/.ssh/id_dsa-cert type -1
debug1: identity file /home/myusername/.ssh/id_ecdsa type -1
debug1: identity file /home/myusername/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/myusername/.ssh/id_ed25519 type -1
debug1: identity file /home/myusername/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 7f:96:64:b2:df:f5:de:e8:af:ff:5d:da:5e:3d:e4:c1
debug1: Host 'localhost' is known and matches the ECDSA host key.
debug1: Found key in /home/myusername/.ssh/known_hosts:12
debug1: ssh_ecdsa_verify: signature correct
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,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/myusername/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/myusername/.ssh/id_dsa
debug1: Trying private key: /home/myusername/.ssh/id_ecdsa
debug1: Trying private key: /home/myusername/.ssh/id_ed25519
debug1: Next authentication method: password

Я прочитал несколько сообщений о похожих проблемах и проверил несколько советов:

  • Каталоги $ HOME (700), .ssh (700) и .ssh/* (644, за исключением полномочий_данных и id_rsa, которые имеют 600) разрешений должны быть правильными
  • подключение через пароль работает

Интересно, что мой компьютер явно заявляет, что он принимает ключ:

debug1: Server accepts key: pkalg ssh-rsa blen 279

Изменить: соответствующие записи auth.log:

May 18 16:34:44 desktop-178 sshd[3330]: error: RSA_public_decrypt failed: error:0407006A:lib(4):func(112):reason(106)
May 18 16:34:52 desktop-178 sshd[3330]: Connection closed by 127.0.0.1 [preauth]

Тем не менее, в конце меня спрашивают мой пароль. Как мне это решить?

1 ответ1

0

Я опубликую это как ответ, потому что это частично решает проблему, но я не удовлетворен, потому что я не понимаю, что происходит не так.

Найдено по адресу: https://www.redhat.com/archives/rhl-list/2009-June/msg03099.html

Если я изменю имя закрытого ключа на id_rsa.old, а затем укажу его с флагом -i, я смогу войти на первый хост.

Я могу подтвердить, что это работает, но это в лучшем случае неприятность и совершенно запутанная.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .