2019-06-07 10:33:31 -04:00
---
2021-10-06 14:12:19 -04:00
stage: Manage
2022-01-26 22:14:06 -05:00
group: Authentication and Authorization
2022-09-21 17:13:33 -04:00
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2019-06-07 10:33:31 -04:00
type: howto
---
2019-07-14 21:04:35 -04:00
2022-01-12 04:15:13 -05:00
# Locked users **(FREE SELF)**
2018-07-18 12:06:31 -04:00
2022-01-12 04:15:13 -05: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 11:07:26 -04: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 04:15:13 -05:00
## Unlock a user from the Admin Area
2022-09-13 20:10:29 -04:00
1. On the top bar, select **Main menu > Admin** .
2022-01-12 04:15:13 -05:00
1. On the left sidebar, select **Overview > Users** .
1. Use the search bar to find the locked user.
2022-10-24 11:11:29 -04:00
1. From the **User administration** dropdown list select **Unlock** .
2022-01-12 04:15:13 -05:00
![Unlock a user from the Admin Area ](img/unlock_user_v14_7.png )
## Unlock a user from the command line
2019-06-07 10:33:31 -04:00
2019-07-16 03:02:20 -04:00
To unlock a locked user:
2018-07-18 12:06:31 -04:00
2019-07-16 03:02:20 -04:00
1. SSH into your GitLab server.
1. Start a Ruby on Rails console:
2018-07-18 12:06:31 -04:00
2020-01-30 10:09:15 -05:00
```shell
2019-07-16 03:02:20 -04:00
## For Omnibus GitLab
2020-02-28 01:09:19 -05:00
sudo gitlab-rails console -e production
2018-07-18 12:06:31 -04:00
2019-07-16 03:02:20 -04:00
## For installations from source
2020-04-15 05:09:46 -04:00
sudo -u git -H bundle exec rails console -e production
2019-07-16 03:02:20 -04:00
```
2018-07-18 12:06:31 -04:00
2019-07-16 03:02:20 -04:00
1. Find the user to unlock. You can search by email or ID.
2018-07-18 12:06:31 -04:00
2019-07-16 03:02:20 -04:00
```ruby
user = User.find_by(email: 'admin@local.host')
```
2018-07-18 12:06:31 -04:00
2019-07-16 03:02:20 -04:00
or
2018-07-18 12:06:31 -04:00
2019-07-16 03:02:20 -04:00
```ruby
user = User.where(id: 1).first
```
2018-07-18 12:06:31 -04:00
2019-07-16 03:02:20 -04:00
1. Unlock the user:
2018-07-18 12:06:31 -04:00
2019-07-16 03:02:20 -04:00
```ruby
user.unlock_access!
```
2021-01-29 16:09:34 -05:00
1. Exit the console with < kbd > Control</ kbd > +< kbd > d</ kbd >
2019-07-16 03:02:20 -04:00
2022-10-11 08:09:17 -04:00
The user should now be able to sign in.
2019-06-07 10:33:31 -04: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. -->