Fix cannot unblock LDAP blocked users

by Daniel Pham
Published: Updated:
This entry is part 9 of 9 in the series Install Gitlab CE on Ubuntu 18

Fix cannot unblock LDAP blocked users. This is an error that you may encounter while operating the Gitlab system.

In the series, I have instructions for you to authenticate gitlab users via LDAP. It is entirely possible that users can be blocked. The reason is because the user enters the wrong password too many times or has some authentication problem causing continuous login failure.

Error cannot unblock LDAP blocked users

Maybe at some point, users will tell you that they cannot log in to the gitlab system.

When you go to the admin window to check, these users’ accounts have been blocked. But you cannot unlock it on the website.

Fix cannot unblock LDAP blocked users
Error cannot unblock ldap blocked users.

So now how to unblock these users?

Fix cannot unblock LDAP blocked users

To fix this error, you must do it from the console interface of the Gitlab system.

First, you log in to the console window.

gitlab-rails console

Next, you use the command structure below to unblock locked user accounts. For each account that needs to be unlocked, you will run these 3 commands. You repeat this set of 3 commands for all blocked users on the system.

user = User.find_by_email("[email protected]")
user.state = "active"

In there:

When done it will look like this.

root@gitlab:~# gitlab-rails console
 GitLab:       13.2.2 (64fc0138d55) FOSS
 GitLab Shell: 13.3.0
 PostgreSQL:   11.7
Loading production environment (Rails
irb(main):001:0> user = User.find_by_email("[email protected]")
=> #<User id:35 @user01>
irb(main):002:0> user.state = "active"
=> "active"
=> true
irb(main):004:0> user = User.find_by_email("[email protected]")
=> #<User id:33 @user02>
irb(main):005:0> user.state = "active"
=> "active"
=> true
irb(main):007:0> exit


Above is the content that I have shown you how to unblock a user account when encountering an LDAP blocked error. Hope this article helps you in necessary situations.

0 0 votes
Article Rating
Series Navigation«« Previous part: Common errors when using SSH keys on Gitlab

You may also like

Notify of
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.



Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 – All rights reserved.

Please write sources “” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Would love your thoughts, please comment.x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.