brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: faillock shows failed logins and clears a locked account

Linux
~/tips/tip-security-faillock-reset-user

sudo faillock --user alice

Shows the failed logins of a user and clears the records that lock the account.

When an account locks itself after too many wrong passwords, I want to know why before I let it back in. On systems with pam_faillock, faillock does both.

The man page says the tool can display the recent failed authentication attempts of a user or clear the tally files. The first command looks, the second one clears:

sudo faillock --user alice
sudo faillock --user alice --reset

Run them in that order. The list shows when the failures happened, and if you did not cause them, someone may be guessing passwords. A reset then treats the symptom only, so check your SSH settings and logs as well.

The records live in /var/run/faillock unless --dir or the config file names another directory. --conf points the tool at a different config file, and the default is /etc/security/faillock.conf. The faillock.conf(5) page gives these defaults: deny is 3 failures, fail_interval is 900 seconds and unlock_time is 600 seconds. So an account that is left alone frees itself after ten minutes, and the reset only saves you the wait. Your distribution may ship other values, so read the file on your own system.

Not every distribution uses pam_faillock. Where it is missing, the command may not exist, and man faillock tells you quickly. A reset clears the records and leaves the password alone, so a user who forgot it is still stuck.

Further reading: faillock(8) man page, faillock.conf(5) man page

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link