0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

SSH接続時: Load key "[鍵ファイル名]": error in libcrypto が出た時の対処方法

Posted at

新しいサーバーの鍵を渡された時、情報は正しいのにうまく接続できない時がありました。

user@MacBook-Pro % ssh -i "id_rsa" user@192.168.1.1
The authenticity of host '[192.168.1.1]:22 ([192.168.1.1]:22)' can't be established.
ED25519 key fingerprint is SHA256:XXXXXXXXXXXXXXXXXXXXXXX.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[192.168.1.1]:22' (ED25519) to the list of known hosts.
Load key "id_rsa": error in libcrypto
user@192.168.1.1: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

普通だったら Permission denied (publickey,gssapi-keyex,gssapi-with-mic). のエラー文を見て、秘密鍵が間違ってるかな?と思うかもしれませんが、その直前にあるエラー文に注目

Load key "[鍵ファイル名]": error in libcrypto

のエラーが出た時は、秘密鍵の最後に、改行が無い時に出るエラーらしいです。

-----BEGIN OPENSSH PRIVATE KEY-----
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
(省略)
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

-----END OPENSSH PRIVATE KEY-----

一番最後に改行を入れて、保存しなおしましょう。

-----BEGIN OPENSSH PRIVATE KEY-----
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
(省略)
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

-----END OPENSSH PRIVATE KEY-----

なんてこったい。

参考
https://github.com/openssl/openssl/issues/13443#issuecomment-1354750805
https://zenn.dev/scenee/articles/66ec402d1f7fe7

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?