The Computer Oracle

How to unlock linux user after too many failed login attempts

-------------------------------------------------------------------------------
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
-------------------------------------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Techno Bleepage Open

--

Chapters
00:00 Question
00:35 Accepted answer (Score 70)
01:48 Answer 2 (Score 9)
02:42 Answer 3 (Score 0)
03:15 Thank you

--

Full question
https://superuser.com/questions/1597162/...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #useraccounts

#avk47



ACCEPTED ANSWER

Score 91


If you still have access to the system by another account
root or some other account with root-like (sudo?) privileges

  1. You can view the failed logins with faillock
    # faillock --user myUsername
    myUsername:
    When            Type     Source     Valid
    Timestamp 1     TTY      /dev/tty1  V
    Timestamp 2     TTY      /dev/tty1  V
    Timestamp 3     TTY      /dev/tty1  V
    
  1. Reset them with the --reset-flag
    # faillock --user myUsername --reset
    # faillock --user myUsername
    myUsername:
    When            Type     Source     Valid
    

If you've found another way to access the file system
through a rescue disk or someone else's computer

  1. Navigate to /var/run/faillock (*), this folder should contain a file with the locked username

    # ls /var/run/faillock
    myUsername
    
  2. Remove the file with the username to unlock

    # rm /var/run/faillock/myUsername

* This is called 'tally directory' and its location depends on your system's configuration, which is likely to be found at /etc/security/faillock.conf




ANSWER 2

Score 15


"sudo" and "faillock" - How to handle "The account is locked due to X failed logins."

If you still have access with root-like privileges, you can view the failed logins...

faillock --user [USERNAME]

... and/or reset attempts status...

faillock --user [USERNAME] --reset

PLUS:

You can change the possible attempts number before a lock by uncommenting and changing the parameter...

# deny = 3

... in the file...

vi /etc/security/faillock.conf

Normally faillock automatically unlocks the account after 10 minutes (600 seconds), but you can change that too...

# unlock_time = 600

[Ref(s).: https://forum.manjaro.org/t/how-to-remove-or-increase-password-attempts/47986/2?u=eduardolucioac ]




ANSWER 3

Score 0


By default tally log is present in /var/run/faillock. If it is configured in /etc/security/faillock.conf to write in different path, then use below command.

faillock --reset --user <user> --dir <tally dir path>