LoginSignup
35
27

More than 5 years have passed since last update.

リカバリーコードなしでGithubの2段階認証を回避する方法

Last updated at Posted at 2017-01-08

みなさんGithubで2段階認証を有効にしていますか?セキュリティーを考えると絶対に有効にしておいた方が良いですよね。そしてリカバリーコードはちゃんと手元にありますか?とても大切なものなので、ない人は今すぐ設定画面からダウンロードしてください。

さて、アメリカに引っ越したのでもちろん携帯の電話番号が変わるのですが、Githubの2段階認証をSMSで受信していたのでログインが一切できないようになりました。そんなときでもリカバリーコードが手元にあれば大丈夫です。手元にあればね!

万策尽きたー

maxresdefault.jpg

でも調べてみと「万策尽きてない!」。復帰方法がありました。なんと2段階認証を無効にできるのです!

参考にした記事はこちら。
Is there a way to restore Github 2FA without recovery codes or backup phone number? - stackoverflow

SSHトークンを取得

まずGithubにSSHキーを登録してあることが前提なのですが、毎日プルリク投げまくってるプログラマーであれば登録してあるはずですよね。

次にコマンドを叩きます。

$ ssh -T git@github.com verify
Please provide the following verification token to GitHub Support.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

なんぞこれ?よくわからないけど、このXXXXXの箇所に表示されてる文字列をGitHub Supportに伝えると2段階認証を無効にしてくれます。

Githubサポートとやり取り

Githubのサイトの下の方に Contact GitHub があるので、そこの問い合わせページを開き、以下のように入力します。

Contact_GitHub.jpg

タイトルは「2段階認証をオフにしてください」をgoogle翻訳さんに変換してもらって「Please turn off 2-step verification」。本文にはアカウント名と、コマンドの出力をそのまま貼り付けて送信。

待つこと3時間。。。メール到着。

Hi there, Kozakai!

Thanks for sending that over.

We recommend using one of the 2FA recovery codes you were asked to save when you enabled 2FA on your account.

I've looked at our logs and I can see that you viewed your recovery codes. Do you recall if you stored these anywhere? If there's a chance that you downloaded them, I'd suggest searching your computer for "github-recovery-codes.txt". This is the default filename and hopefully what they will be stored as.

If you are unable to locate these codes then I will be happy to test that SSH token for you.

I hope this helps, and please let us know if you have any other questions!

Best,
Kimmy

Google翻訳さん出番ですよ!

こんにちは、こじかい!

それを送ってくれてありがとう。

アカウントで2FAを有効にしたときに保存するよう求められた2FAのリカバリコードのいずれかを使用することをおすすめします。

私は私たちのログを見て、それを保存しているのを見ます。 どこに保存したのか想起したら? "github-recovery-codes.txt"の検索をお勧めします。 これはデフォルトのファイル名であり、うまくいけばそれらが格納される場所です。

これらのコードを見つけることができない場合は、そのSSHトークンをテストしてください。

私はこれが助けてくれることを願っており、他に質問があれば教えてください!

ベスト、
キミ

誰が「こじかい」じゃ!
とりあえずリカバリーコードを探してくれという内容だけど手元にはないのです。あとGoogle翻訳さん、訳が間違ってます。

If you are unable to locate these codes then I will be happy to test that SSH token for you.
これらのコードを見つけることができない場合は、そのSSHトークンをテストしてください。

じゃなくて

If you are unable to locate these codes then I will be happy to test that SSH token for you.
これらのコードを見つけることができない場合は、喜んでSSHトークンのテストをさせていただきます。

です。では喜んでもらうためにこんな返信を書きます。

I am unable to locate recovery codes. You will be happy to test that SSH token for me.

送らてきた If you are unable to locate these codes then I will be happy to test that SSH token for you. の I と You を反転させて少し変えたくらい。和訳すると

私はリカバリーコードを見つける事ができません。あなたは喜んで私のためにSSHトークンのテストをします。

笑える英語だなと思ったのだけど、念のため英語がネイティブ並な妻に見せたら「これを受け取ったサポートの人は笑うだろう」ということなので、サポートの人に楽しんでもらうためにこのまま送ります。

待つこと1時間。。。

Hey Kozakai,

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. If you ever disable and then re-enable 2FA, be sure to download the new codes we generate — the old ones will no longer work.

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

Add a security key. Phone got stolen and you lost your recovery codes? Today is turning into a rough day, but you'll still have access to your account if you have a FIDO U2F security key added to your account.

https://help.github.com/articles/configuring-two-factor-authentication-via-fido-u2f

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

Best,
Kimmy

Google先生出番ですよ

ちょっとコザカイ、

それを送ってくれてありがとう。私はあなたのアカウントの二要素認証を無効にしたので、今すぐログインできるようになりました。すぐにこれを再度有効にしてください。それは今日のいくつかの面倒を引き起こした可能性がありますが、これはいくつかの予防措置をとることによって道路を避けることができます。

リカバリコードをダウンロードします。これはあなたのアカウントからロックされていないことを確認する最も良い方法です。 2FAを無効にして再度有効にする場合は、生成された新しいコードをダウンロードしてください。古いコードは使用できなくなります。

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

フォールバック番号を設定します。電話が紛失していない限り、SMSの受信にかかる時間内にアカウントへのアクセスを回復することができます。

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

セキュリティキーを追加します。電話が盗まれ、リカバリコードが失われましたか?今日は大変な日ですが、アカウントにFIDO U2Fセキュリティキーが追加されていれば、引き続きアカウントにアクセスできます。

https://help.github.com/articles/configuring-two-factor-authentication-via-fido-u2f

私があなたを助けることができる他の方法があれば教えてください!

ベスト、
キミ

なんか冒頭からもの凄く軽いノリなのは、たぶん僕の送った英文を喜んでもらえたからにちがいない。

やったー!

そんなこんなで無事に2段階認証が解除されGithubにログインできるよになりました。そして、即2段階認証を有効にしてリカバリーコードをダウンロード。みなさんリカバリーコードは忘れずにダウンロードしましょう。

35
27
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
35
27