やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

GitHubサブアカウントの2FAリカバリコードでログインできなかった

困った。

現状の確認

リカバリコードならログインできるはずだったのに。

別解

最悪、永久放置して新しいアカウントを取得してもいい。

でも、もったいないし、ゴミアカウントを残すのは忍びない。できれば回復させたい。

原因の予想

バックアップしたリカバリコードが間違っていたのか。よくわからない。

2FAを有効にする設定の時、失敗して何度かやり直したりしていた。そのときバックアップし忘れたのだろうか?注意してやっていたと思うが、覚えていない。

2FAの秘密鍵も?

もしかして、2FAの秘密鍵も間違っていたのか?だから正しいワンタイムパスワードを生成できなかったのか?WinAuthで登録したのと同じだと思うのだが、確かめる術を知らない。

さて、もう2FAやめたいのだが、どうしよう。

調べてみた

GitHubで二段階認証のトークンが使えなくなった時やること - Qiita

参考にした。感謝。

GitHubアカウントで二要素認証を解除してもらう

上記によると、SSH鍵登録してあればサポートキーを発行してくれるらしい。このキーを書いて解除してくれとメールでお願いすれば解除してもらえるらしい。

なんという人力。

サポートキー取得

ssh -i ~/.ssh/rsa_csharpstudy0 -T git@github.com.csharpstudy0 verify
$ ssh -i ~/.ssh/rsa_csharpstudy0 -T git@github.com.csharpstudy0 verify
Please provide the following verification token to GitHub Support.
{サポートキー}

解除依頼メール

以下の文章をGoogle翻訳にかけた英文を送信した。

2FAを無効にしてください

2FAを無効にしていただけますか?

リカバリコードを入力しましたが、ログインできませんでした。
誤ったものをバックアップしてしまったのかもしれません。
もう覚えておりません。

以下のサイトでサポートしていただけると知りました。
https://medium.com/@kaumac/how-to-recover-your-github-account-if-you-lost-your-2fa-credentials-and-recovery-codes-d171b2bb87f0#.nb4oqmcs2

SSH鍵によるサポートコードは以下のように取得しました。

$ ssh -i ~/.ssh/rsa_csharpstudy0 -T git@github.com.csharpstudy0 verify
Please provide the following verification token to GitHub Support.
{サポートキー}

よろしくお願いいたします。
Please disable 2FA

Could you disable 2FA?

I entered a recovery code but I could not log in.
It may be that I backed up the wrong one.
I do not remember it anymore.

I found out that you can support at the following site.

https://medium.com/@kaumac/how-to-recover-your-github-account-if-you-lost-your-2fa-credentials-and-recovery-codes-d171b2bb87f0#.nb4oqmcs2

I got the support code with the SSH key as follows.

$ ssh -i ~/.ssh/rsa_csharpstudy0 -T git@github.com.csharpstudy0 verify
Please provide the following verification token to GitHub Support.
{サポートキー}

Thank you.

こんな文章でいいのだろうか。まわりくどい挨拶は少ないほうがいいと思って簡素にしたつもりだが。

あとはメールを待つだけ。たぶん数日かかると思われる。

と思ったら、わりと早かった。しかし私が肝心のユーザ名を知らせ忘れたためもう一度連絡した。

以下、対応していただけた。感謝。

Hey there,

Thanks for sending that over. I've just disabled two-factor authentication for your account, so you'll now be able to log in. As soon as you do, please be sure to re-enable this; it may have caused some hassle today, but this can be avoided down the road by taking some precautions.

Download your recovery codes. This is far and away the best way to make sure you don't get locked out of your account.

https://help.github.com/articles/downloading-your-two-factor-authentication-recovery-codes

Set a fallback number. As long as your phone wasn't lost, you'll be able to regain access to your account in the amount of time it takes to receive an SMS.

https://help.github.com/articles/setting-a-fallback-authentication-number

Set up Recover Accounts Elsewhere. If you're otherwise unable to authenticate, this feature allows you to verify your ownership of a GitHub account using a token stored elsewhere.

https://help.github.com/articles/about-recover-accounts-elsewhere/

Please let me know if there is any other way I can assist you!

2FAが解除され、ログインできた。

その旨を伝え、お礼メールを送って締めくくった。

リカバリコードについて

有効期限

Google 翻訳

アカウント回復トークンは、1年間または使用するまで有効です。 トークンを取得した場合、またはトークンの有効期限が切れた場合は、新しいトークンを生成して保存する必要があります。 

保存しておいても安心できない。

回数制限

Google 翻訳

リカバリコードを使用してアカウントへのアクセスを再利用すると、リカバリコードを再利用することはできません。 16のリカバリコードをすべて使用した場合は、[ 新しいリカバリコードを生成する ]をクリックして、別のリカバリコードのバッチを再作成します。

リカバリコードは1つでなく、16個だった。あれ全部で1つのリカバリコードだと思っていた。私はそもそも使い方を間違っていたようだ。

1つのリカバリコードは1回限り。全部使い果たしたら新しいのを作れと。

所感

2FAは思った以上に面倒くさい。