Howto: Disable 2FA in getlab for a user

Posted on

Gitlab supported 2FA and U2F device support to improve security in the public network. We need to configure GoogleAuthenticator in smartphone and register to the existing Gitlab user to allow logins, in some cases if we lost phone or  unable to access GoogleAuthenticator  we can’t to login GitLab,

GitLab share recovery codes to initiate recovery process, but if we also lost recovery codes, the following method help to disable 2FA and allow us to login,

Login to the SSH on Gitlab Server and connect to PostgreSQL.

[root@control3 master]# sudo -u gitlab-psql -i bash

Login to the postgres

bash-4.1$ /opt/gitlab/embedded/bin/psql --port 5432 -h /var/opt/gitlab/postgresql -d gitlabhq_production

Disable 2FA for user, here I used username root,

gitlabhq_production=# UPDATE public.users SET otp_required_for_login = false WHERE username = 'root';

Now you can login through browser, it ask to enable  2FA. hope this help you.

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s