-   Linux - Newbie (
-   -   set up failed Login attempts, now linux password doesnt work? (

affinity0g 07-14-2020 01:05 AM

set up failed Login attempts, now linux password doesnt work?
I wanted to make it so that if 3 failed password attempts occur, the password cant be typed for at least 5-10minutes.

I did the following:

Add the following lines in the file “/etc/pam.d/common-auth”

auth required onerr=fail deny=3 unlock_time=300 audit
auth required onerr=fail deny=3 unlock_time=300 audit even_deny_root root_unlock_time=600


Then I tested it running a sudo apt-get install call, purposely made 3 incorrect password attempts. Now whenever I make a sudo call, it always says the password is incorrect. Even after I restart the computer and even after more than 10 minutes has passed. Locking the workspace/unlocking and logging into the desktop works but seems like any sudo call or even a passwd change wont work. It recognizes my password as incorrect now.

I cant even edit that file anymore to remove those lines as it requires sudo.

How can i Fix this?
Why did this happen?

Many thanks!

berndbausch 07-14-2020 07:50 PM

You can reset the root password by booting in single user mode or with the help of recovery media. Precise instructions vary depending on your distro.

I wonder if the "onerr=fail" option is the culprit here. The man page states, somewhat vaguely:

If something weird happens (like unable to open the file), return with PAM_SUCCESS if onerr=succeed is given, else with the corresponding PAM error code.
Perhaps "something weird" is happening on your computer. I would set onerr=succeed as a first step. I would also check the various relevant log files for information about this problem, like /var/log/tallylog, /var/log/secure, /var/log/auth.log or whatever you have on your system. Then there is the pam_tally2 command, which might provide useful information as well.

All times are GMT -5. The time now is 03:03 PM.