Score:-1

I need my Ubuntu 22.04 Profiles to lock after 20 unsuccessful attempts for a duration of 15 minutes

za flag

If someone would be able to assist me in how to go about locking an Ubuntu 22.04 profile after 20 unsuccessful login attempts for a duration of 15 minutes with steps, that would be wonderful! Thanks in advance!

Organic Marble avatar
us flag
What is an "Ubuntu profile"?
Score:2
ng flag

The method to utilize this is via PAM, and specifically the faillock module. Here's how I made it work on mine (albeit I'm running 23.04, but I did check that the same module exists on 22.04):

  1. Open a terminal
  2. Make a backup of the file /etc/pam.d/common-auth for instance with issuing a command
sudo cp /etc/pam.d/common-auth /etc/pam.d/common-auth.original
  1. Open the file /etc/pam.d/common-auth in your favourite editor (and don't forget to use sudo!)
  2. As the first line right after # here are the per-package modules (the "Primary" block) add
auth    required            pam_faillock.so preauth audit deny=20 unlock_time=900
  1. As first two lines right after # here's the fallback if no module succeeds add
auth    [default=die]           pam_faillock.so authfail audit deny=20 unlock_time=900
auth    sufficient              pam_faillock.so authsucc audit deny=20 unlock_time=900

If you want to add a period during which the failed attempts are counted, the fail_interval=60 option will set a period of one (1) minute.

In my testing, I set the deny value to three (3) failed attempts and the unlock_time to 20 seconds , and after the required failed attempts I saw the following:

[18:50:59] /home/jaska/> su jjo
The account is locked due to 3 failed logins.
(1 minute left to unlock)

Hope this helps, further reading on the module: https://manpages.ubuntu.com/manpages/jammy/en/man8/pam_faillock.8.html

https://kifarunix.com/lock-linux-user-account-after-multiple-failed-login-attempts/

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.