[Bug 3951] For some keys, "ssh-add -l" shows the pathname instead of the comment

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Tue Sep 15 15:06:26 AEST 2026


https://bugzilla.mindrot.org/show_bug.cgi?id=3951

--- Comment #5 from Damien Miller <djm at mindrot.org> ---
(In reply to Vincent Lefevre from comment #4)
> Moreover, I recall that "ssh-keygen -l -f <private_key>" does not
> have any issue to show the comment.

ssh-keygen has easier access to the public key alongside the private
key.

I'd suggest converting the private keys to the new format. E.g.

[djm at djm-desktop ~]$ ssh-keygen -m PEM -t RSA -f /tmp/k1 -N ''
Generating public/private rsa key pair.
Your identification has been saved in /tmp/k1
Your public key has been saved in /tmp/k1.pub
The key fingerprint is:
SHA256:NnNF60wQEPRRznfX7lbvPI1WNaU0K9XXeH1M9ugLNXQ djm at djm-desktop
The key's randomart image is:
+---[RSA 3072]----+
|       .+o+oo .=E|
|         . * o=+%|
|          . *o==O|
|           =.+o=o|
|        S . +.. =|
|       . +   . o+|
|              .o=|
|              o=.|
|             .  +|
+----[SHA256]-----+
[djm at djm-desktop ~]$ head -1 /tmp/k1
-----BEGIN RSA PRIVATE KEY-----
[djm at djm-desktop ~]$ ssh-keygen -cC "new comment" -f /tmp/k1
No existing comment
Comment 'new comment' applied
[djm at djm-desktop ~]$ head -1 /tmp/k1
-----BEGIN OPENSSH PRIVATE KEY-----

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.


More information about the openssh-bugs mailing list