When you fail to enter the correct password multiple times while using sudo, your account might get locked for security reasons. This is a security feature to prevent brute force attacks. Here’s how to check and unlock your account using the faillock command.
First, check the status of failed attempts:
| |
This will show you a list of users and their failed attempts. The output will look something like this:
| |
To reset the failed attempts for your user:
| |
Replace your_username with your actual username.
To reset all users’ failed attempts (use with caution):
| |
After resetting, you should be able to use sudo again. If you want to prevent this from happening in the future, you can:
- Use a password manager to store your sudo password
- Configure the number of allowed failed attempts in
/etc/security/faillock.conf - Set up a longer timeout period between attempts
Remember that this security feature is in place to protect your system, so use these commands responsibly.