3

I have a situation, Google Authenticator generates non-valid codes and my recovery codes are all expired, how can I disable it via command line?

Moe Far
  • 2,742
  • 2
  • 23
  • 41

1 Answers1

2

I found the answer, we can disable it via gitlab-rails :

gitlab-rails runner 'User.update_all(otp_required_for_login: false, encrypted_otp_secret: "")'
Moe Far
  • 2,742
  • 2
  • 23
  • 41
  • 2
    After running this command I was unable to enable 2FA again, but running `gitlab-rails runner User.update_all(otp_required_for_login: false, encrypted_otp_secret: nil, encrypted_otp_secret_iv: nil, encrypted_otp_secret_salt: nil, otp_backup_codes: nil)` and then `gitlab-ctl reconfigure` fixed it for me. – Jagjot Jul 06 '16 at 16:57
  • 4
    @JagjotSingh You are missing a `'` wrapping from `User...` to the end of your command. After adding them it works. Thanks – Alberto Méndez Feb 07 '17 at 21:08