How to disable the Two-factor authentication in GitLab?
Gitlab has updated the command to disable two-factor authentication for all users to this:
sudo gitlab-rails runner 'User.find_each(&:disable_two_factor!)'
@poldixd's answer should still work. If it doesn't try setting encrypted_opt_secret to nil
instead of ""
.
Found this here: https://gitlab.com/gitlab-org/gitlab-ce/issues/1960
This command turn of the Two-factor authentication for all users:sudo gitlab-rails runner 'User.update_all(otp_required_for_login: false, encrypted_otp_secret: "")'
For a installation from source you can run
cd /home/git/gitlab
sudo -u git -H bundle exec rails console production
to get a rails console and then enter
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)
to run the command.