2019-06-07 14:33:31 +00:00
---
2021-10-06 18:12:19 +00:00
stage: Manage
2022-01-27 03:14:06 +00:00
group: Authentication and Authorization
2020-11-26 06:09:20 +00:00
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2019-06-07 14:33:31 +00:00
type: howto
---
2019-07-15 01:04:35 +00:00
2022-01-12 09:15:13 +00:00
# Locked users **(FREE SELF)**
2018-07-18 16:06:31 +00:00
2022-01-12 09:15:13 +00:00
Users are locked after ten failed sign-in attempts. These users remain locked:
- For 10 minutes, after which time they are automatically unlocked.
2022-05-11 15:07:26 +00:00
- Until an administrator unlocks them from the [Admin Area ](../user/admin_area/index.md ) or the command line in under 10 minutes.
2022-01-12 09:15:13 +00:00
## Unlock a user from the Admin Area
1. On the top bar, select **Menu > Admin** .
1. On the left sidebar, select **Overview > Users** .
1. Use the search bar to find the locked user.
1. From the **User administration** dropdown select **Unlock** .
![Unlock a user from the Admin Area ](img/unlock_user_v14_7.png )
## Unlock a user from the command line
2019-06-07 14:33:31 +00:00
2019-07-16 07:02:20 +00:00
To unlock a locked user:
2018-07-18 16:06:31 +00:00
2019-07-16 07:02:20 +00:00
1. SSH into your GitLab server.
1. Start a Ruby on Rails console:
2018-07-18 16:06:31 +00:00
2020-01-30 15:09:15 +00:00
```shell
2019-07-16 07:02:20 +00:00
## For Omnibus GitLab
2020-02-28 06:09:19 +00:00
sudo gitlab-rails console -e production
2018-07-18 16:06:31 +00:00
2019-07-16 07:02:20 +00:00
## For installations from source
2020-04-15 09:09:46 +00:00
sudo -u git -H bundle exec rails console -e production
2019-07-16 07:02:20 +00:00
```
2018-07-18 16:06:31 +00:00
2019-07-16 07:02:20 +00:00
1. Find the user to unlock. You can search by email or ID.
2018-07-18 16:06:31 +00:00
2019-07-16 07:02:20 +00:00
```ruby
user = User.find_by(email: 'admin@local.host')
```
2018-07-18 16:06:31 +00:00
2019-07-16 07:02:20 +00:00
or
2018-07-18 16:06:31 +00:00
2019-07-16 07:02:20 +00:00
```ruby
user = User.where(id: 1).first
```
2018-07-18 16:06:31 +00:00
2019-07-16 07:02:20 +00:00
1. Unlock the user:
2018-07-18 16:06:31 +00:00
2019-07-16 07:02:20 +00:00
```ruby
user.unlock_access!
```
2021-01-29 21:09:34 +00:00
1. Exit the console with < kbd > Control</ kbd > +< kbd > d</ kbd >
2019-07-16 07:02:20 +00:00
The user should now be able to log in.
2019-06-07 14:33:31 +00:00
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
one might have when setting this up, or when something is changed, or on upgrading, it's
important to describe those, too. Think of things that may go wrong and include them here.
This is important to minimize requests for support, and to avoid doc comments with
questions that you know someone might ask.
Each scenario can be a third-level heading, e.g. `### Getting error message X` .
If you have none to add when creating a doc, leave this section in place
but commented out to help encourage others to add to it in the future. -->