Ubuntu Server インストーラの Github, Launchpad からの ssh公開鍵インポート機能

github.com/settings/keys からSSH Keyとして突っ込んどくと便利だし、今のUbuntu Serverはセットアップでそれを使う項目すらあるので

なるほど便利そう
試してみようと Ubuntu Server 18.04.2 LTS
(ubuntu-18.04.2-live-server-amd64.iso) のインストーラで試してみました.

OpenSSH を導入するようにすると,SSH鍵をインポートするオプションで Github / Launchpad が選べます.
Screenshot ubuntu18 04 2019 03 30 13 02 56

こんな感じでインポートされました.
Screenshot ubuntu18 04 2019 03 30 13 05 37

インストールが終了して ssh login するとインポートされた鍵で login 出来ました.

インポートされた公開鍵を確認するとコメント部分が少し書き換わっています.

$ cat ~/.ssh/authorized_keys
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPgwY9aZPxN/YoBBzd7TOcCk7EuGO0E9PuUjCHPtTuHP matoken@github/16598604 # ssh-import-id gh:matoken
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEoKnbjj7cVafcAJbYHqUEua1x/81uzoK0LnjgqmR6H8 matoken@github/33364582 # ssh-import-id gh:matoken

sshd_config を見ると編集ではなく末尾に追記してるのでちょっと雑い感.

$ grep PasswordAuthentication /etc/ssh/sshd_config
#PasswordAuthentication yes
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication, then enable this but set PasswordAuthentication
PasswordAuthentication no
$ tail -1 /etc/ssh/sshd_config
PasswordAuthentication no

ちなみに,Github から鍵を入手するのはこんな感じで行けるようです.
(<USERNAME>部分を該当ユーザ名に修正)

Launchpad はこんな感じ.

ちなみにLaunchpad は未だED25519形式には未対応なようです.
20190330 13 03 12 27418

Bitbucket の鍵も同様に https://api.bitbucket.org/2.0/users/<USERNAME>/ssh-keys 🏛️ で入手できそうと思ったのですが,未認証では駄目みたいです.

$ curl -s https://api.bitbucket.org/2.0/users/matoken/ssh-keys|jq
{
  "type": "error",
  "error": {
    "message": "This API is only accessible with the following authentication types: session, password, apppassword"
  }
}
環境
$ lsb_release -d
Description:	Ubuntu 18.04.2 LTS
$ uname -m
x86_64

One thought to “Ubuntu Server インストーラの Github, Launchpad からの ssh公開鍵インポート機能”

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)