平衡点


2023/11/29

_ GPGで複数の認証鍵がある場合の --export-ssh-key

某所向けに ed25519 の鍵を追加したのだけれど, 単に --export-ssh-key を唱えただけだと新しく追加した鍵の SSH 公開鍵しか出力されずに困ったり.

man を紐解くと, ちゃんと

--export-ssh-key
       This command is used to export a key in the OpenSSH public key format.
       It requires the specification of one key by the usual means and exports
       the latest valid subkey which has an authentication capability to
       STDOUT or to the file given with option --output.  That output can
       directly be added to ssh's `authorized_key' file.

       By specifying the key to export using a key ID or a fingerprint
       suffixed with an exclamation mark (!), a specific subkey or the primary
       key can be exported.  This does not even require that the key has the
       authentication capability flag set.

って書いてあった.

というわけで, 例えば

% gpg --list-keys 0x9394F354891D7E07
pub   rsa4096/0x9394F354891D7E07 2009-09-03 [SC]
      Key fingerprint = 66A4 EA70 4FE2 4055 8D6A  C2E6 9394 F354 891D 7E07
uid                   [ultimate] Youhei SASAKI <uwabami@gfd-dennou.org>
uid                   [ultimate] Youhei SASAKI (JunkHub) <uwabami@junkhub.org>
uid                   [ultimate] Youhei SASAKI (Debian JP Project) <uwabami@debian.or.jp>
sub   rsa4096/0xB41AF9579DBFD29F 2009-09-03 [E]
sub   rsa4096/0xBC8C7730B7DB0213 2016-12-12 [A]
sub   ed25519/0xC317F1D44E1D42F5 2023-11-29 [A]

という場合には

% gpg --export-ssh-key 0xBC8C7730B7DB0213!
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDMXEKNZcb/ ... 

とか

% gpg --export-ssh-key 0xC317F1D44E1D42F5!
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHsCFjPi+CvZzW...

として export したい鍵の指紋! を指定すれば良い, ということでした.


連絡先など
最近の日記
一覧
2006|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|02|03|04|08|09|10|11|12|
2013|01|02|03|04|05|06|08|09|10|11|12|
2014|01|02|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|09|10|
2016|02|03|
2017|01|02|03|05|06|07|09|11|12|
2018|03|06|07|10|11|12|
2019|01|02|03|04|05|07|10|12|
2020|01|02|03|04|05|08|09|10|11|12|
2021|01|02|03|05|06|07|08|09|11|12|
2022|01|02|03|04|05|06|08|10|11|12|
2023|02|03|04|06|08|09|11|12|
2024|01|02|03|
Back to Top ▲