how to use the faillog command with its examples

The faillog command is used to get the login failure iformation from the /var/log/faillog file. Which display faillog records or set login failure limits. It comes from “shadow-utils-4.1.4.2” package. Configuration file is /var/log/faillog – Failure logging file.

Examples:

1. To display the faillog records for all the users

$ faillog -a

Note: If it shows no “/var/log/faillog” file then create it. 

2. To lock a account for specified time in seconds after login failure

$ faillog -l 60 -u mike

3. To Set the maximum number of login failures

$ faillog -m 10 -u mike
$ faillog –maximum 10 -u mike 

4. To reset the counters of login failures.

$ faillog -r -u mike
$ faillog -ur mike

$ faillog –reset -u mike

5. To display faillog records more recent than DAYS

$ faillog -t 5 mike
$ faillog –time DAYS mike

6. To display faillog record or maintains failure counters and limits

$ faillog -u root
$ faillog –user LOGIN|RANGE root

7. To get the help for faillog

$ faillog -h
$ faillog –help 

Related Commands: login, faillog 

faillog command not found

If incase the faillog command is not found under your system, then it is because the system is not having “shadow-utils” package installed.Hence please follow command to install same.

OS VersionCommand to install
RedHat / Fedora / CentOSyum install shadow-utils
Debian / Ubuntu / Kubuntuapt install shadow-utils

Leave a Reply

Your email address will not be published. Required fields are marked *