pam_tally2 not locking user out after failed attempts on Ubuntu 14 and 16











up vote
2
down vote

favorite












I'm not sure if this issue is with pam_tally2 itself or with Ubuntu which is what I'm trying to find out. pam_tally2 for some reason is having issues on 14 and 16. My /etc/pam.d/common-auth file looks as follows:



auth      required      pam_env.so
auth required pam_tally2.so deny=5 unlock_time=900 onerr=fail
auth [success=1 default=ignore] pam_unix.so nullok_secure
auth requisite pam_deny.so
auth required pam_permit.so
auth optional pam_cap.so


The first two lines I inserted manually based on previous forums and the man page. (For testing purposes I changed deny to =3 and unlock_time to =20 so as not to take so long testing).




  1. After doing so, nothing seems to take effect until I reboot the machine which is unlike pam where usually changes to pam take effect immediately.

  2. After rebooting and intentionally failing password input 3 times I am successfully locked out for 20 seconds however I notice the counter says I failed 4 times even though it's only 3. Also taking note, when inputting the wrong password, the usual message displayed is Invalid password, please try again, in red text and once the system is locked out, the message Account locked due to 4 failed logins, appears in white text.

  3. After waiting 20 seconds and inputting the correct password, it still fails me one more time before changing the fail text to the original red text but then unlocking after I put the password in correctly yet again. Furthermore, the account lockout only seems to work on the first login after the system reboot. If I login correctly that once or intentionally fail logging in, afterwards, I will be able to login no matter how many times I fail.


Some forums and blogs say that you also need to put:



account     required     pam_tally2.so


inside the common-account file also



Other forums say to put the the aforementioned line but with all the options that you put in the common-auth file too. Neither of these approaches seem to make pam_tally2 work.



I've also tried experimentally to put



account     required     pam_env.so


inside the common-account file as the first line. This doesn't seem to work or change anything either.



I've tried putting the pam_env.so line above and below the pam_tally2.so in both files in all possible combinations and this doesn't seem to correct the behavior.



If anyone knows why pam_tally2.so isn't working or if it's a bug with Ubuntu please let me know. Thank you for your time.










share|improve this question
























  • I have been dealing with similar issues on 16.04 to get this all working. Many answers online are incorrect or incomplete. Here is a link to a good and correct explanation. (linux-audit.com/…) I have the lockout working correctly except for the lock screen does not increment the tally. The lock screen is controlled by gnome-screensaver, where the login/switch user screen is controlled by lightdm. Your issue may be similar where the first time after a reboot you are using lightdm, and later attempts are using the lock screen.
    – Andrew Vian
    May 11 '17 at 21:14















up vote
2
down vote

favorite












I'm not sure if this issue is with pam_tally2 itself or with Ubuntu which is what I'm trying to find out. pam_tally2 for some reason is having issues on 14 and 16. My /etc/pam.d/common-auth file looks as follows:



auth      required      pam_env.so
auth required pam_tally2.so deny=5 unlock_time=900 onerr=fail
auth [success=1 default=ignore] pam_unix.so nullok_secure
auth requisite pam_deny.so
auth required pam_permit.so
auth optional pam_cap.so


The first two lines I inserted manually based on previous forums and the man page. (For testing purposes I changed deny to =3 and unlock_time to =20 so as not to take so long testing).




  1. After doing so, nothing seems to take effect until I reboot the machine which is unlike pam where usually changes to pam take effect immediately.

  2. After rebooting and intentionally failing password input 3 times I am successfully locked out for 20 seconds however I notice the counter says I failed 4 times even though it's only 3. Also taking note, when inputting the wrong password, the usual message displayed is Invalid password, please try again, in red text and once the system is locked out, the message Account locked due to 4 failed logins, appears in white text.

  3. After waiting 20 seconds and inputting the correct password, it still fails me one more time before changing the fail text to the original red text but then unlocking after I put the password in correctly yet again. Furthermore, the account lockout only seems to work on the first login after the system reboot. If I login correctly that once or intentionally fail logging in, afterwards, I will be able to login no matter how many times I fail.


Some forums and blogs say that you also need to put:



account     required     pam_tally2.so


inside the common-account file also



Other forums say to put the the aforementioned line but with all the options that you put in the common-auth file too. Neither of these approaches seem to make pam_tally2 work.



I've also tried experimentally to put



account     required     pam_env.so


inside the common-account file as the first line. This doesn't seem to work or change anything either.



I've tried putting the pam_env.so line above and below the pam_tally2.so in both files in all possible combinations and this doesn't seem to correct the behavior.



If anyone knows why pam_tally2.so isn't working or if it's a bug with Ubuntu please let me know. Thank you for your time.










share|improve this question
























  • I have been dealing with similar issues on 16.04 to get this all working. Many answers online are incorrect or incomplete. Here is a link to a good and correct explanation. (linux-audit.com/…) I have the lockout working correctly except for the lock screen does not increment the tally. The lock screen is controlled by gnome-screensaver, where the login/switch user screen is controlled by lightdm. Your issue may be similar where the first time after a reboot you are using lightdm, and later attempts are using the lock screen.
    – Andrew Vian
    May 11 '17 at 21:14













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I'm not sure if this issue is with pam_tally2 itself or with Ubuntu which is what I'm trying to find out. pam_tally2 for some reason is having issues on 14 and 16. My /etc/pam.d/common-auth file looks as follows:



auth      required      pam_env.so
auth required pam_tally2.so deny=5 unlock_time=900 onerr=fail
auth [success=1 default=ignore] pam_unix.so nullok_secure
auth requisite pam_deny.so
auth required pam_permit.so
auth optional pam_cap.so


The first two lines I inserted manually based on previous forums and the man page. (For testing purposes I changed deny to =3 and unlock_time to =20 so as not to take so long testing).




  1. After doing so, nothing seems to take effect until I reboot the machine which is unlike pam where usually changes to pam take effect immediately.

  2. After rebooting and intentionally failing password input 3 times I am successfully locked out for 20 seconds however I notice the counter says I failed 4 times even though it's only 3. Also taking note, when inputting the wrong password, the usual message displayed is Invalid password, please try again, in red text and once the system is locked out, the message Account locked due to 4 failed logins, appears in white text.

  3. After waiting 20 seconds and inputting the correct password, it still fails me one more time before changing the fail text to the original red text but then unlocking after I put the password in correctly yet again. Furthermore, the account lockout only seems to work on the first login after the system reboot. If I login correctly that once or intentionally fail logging in, afterwards, I will be able to login no matter how many times I fail.


Some forums and blogs say that you also need to put:



account     required     pam_tally2.so


inside the common-account file also



Other forums say to put the the aforementioned line but with all the options that you put in the common-auth file too. Neither of these approaches seem to make pam_tally2 work.



I've also tried experimentally to put



account     required     pam_env.so


inside the common-account file as the first line. This doesn't seem to work or change anything either.



I've tried putting the pam_env.so line above and below the pam_tally2.so in both files in all possible combinations and this doesn't seem to correct the behavior.



If anyone knows why pam_tally2.so isn't working or if it's a bug with Ubuntu please let me know. Thank you for your time.










share|improve this question















I'm not sure if this issue is with pam_tally2 itself or with Ubuntu which is what I'm trying to find out. pam_tally2 for some reason is having issues on 14 and 16. My /etc/pam.d/common-auth file looks as follows:



auth      required      pam_env.so
auth required pam_tally2.so deny=5 unlock_time=900 onerr=fail
auth [success=1 default=ignore] pam_unix.so nullok_secure
auth requisite pam_deny.so
auth required pam_permit.so
auth optional pam_cap.so


The first two lines I inserted manually based on previous forums and the man page. (For testing purposes I changed deny to =3 and unlock_time to =20 so as not to take so long testing).




  1. After doing so, nothing seems to take effect until I reboot the machine which is unlike pam where usually changes to pam take effect immediately.

  2. After rebooting and intentionally failing password input 3 times I am successfully locked out for 20 seconds however I notice the counter says I failed 4 times even though it's only 3. Also taking note, when inputting the wrong password, the usual message displayed is Invalid password, please try again, in red text and once the system is locked out, the message Account locked due to 4 failed logins, appears in white text.

  3. After waiting 20 seconds and inputting the correct password, it still fails me one more time before changing the fail text to the original red text but then unlocking after I put the password in correctly yet again. Furthermore, the account lockout only seems to work on the first login after the system reboot. If I login correctly that once or intentionally fail logging in, afterwards, I will be able to login no matter how many times I fail.


Some forums and blogs say that you also need to put:



account     required     pam_tally2.so


inside the common-account file also



Other forums say to put the the aforementioned line but with all the options that you put in the common-auth file too. Neither of these approaches seem to make pam_tally2 work.



I've also tried experimentally to put



account     required     pam_env.so


inside the common-account file as the first line. This doesn't seem to work or change anything either.



I've tried putting the pam_env.so line above and below the pam_tally2.so in both files in all possible combinations and this doesn't seem to correct the behavior.



If anyone knows why pam_tally2.so isn't working or if it's a bug with Ubuntu please let me know. Thank you for your time.







pam






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 6 '16 at 22:20









Zanna

49.2k13124234




49.2k13124234










asked Dec 6 '16 at 20:08









liquidoshin

113




113












  • I have been dealing with similar issues on 16.04 to get this all working. Many answers online are incorrect or incomplete. Here is a link to a good and correct explanation. (linux-audit.com/…) I have the lockout working correctly except for the lock screen does not increment the tally. The lock screen is controlled by gnome-screensaver, where the login/switch user screen is controlled by lightdm. Your issue may be similar where the first time after a reboot you are using lightdm, and later attempts are using the lock screen.
    – Andrew Vian
    May 11 '17 at 21:14


















  • I have been dealing with similar issues on 16.04 to get this all working. Many answers online are incorrect or incomplete. Here is a link to a good and correct explanation. (linux-audit.com/…) I have the lockout working correctly except for the lock screen does not increment the tally. The lock screen is controlled by gnome-screensaver, where the login/switch user screen is controlled by lightdm. Your issue may be similar where the first time after a reboot you are using lightdm, and later attempts are using the lock screen.
    – Andrew Vian
    May 11 '17 at 21:14
















I have been dealing with similar issues on 16.04 to get this all working. Many answers online are incorrect or incomplete. Here is a link to a good and correct explanation. (linux-audit.com/…) I have the lockout working correctly except for the lock screen does not increment the tally. The lock screen is controlled by gnome-screensaver, where the login/switch user screen is controlled by lightdm. Your issue may be similar where the first time after a reboot you are using lightdm, and later attempts are using the lock screen.
– Andrew Vian
May 11 '17 at 21:14




I have been dealing with similar issues on 16.04 to get this all working. Many answers online are incorrect or incomplete. Here is a link to a good and correct explanation. (linux-audit.com/…) I have the lockout working correctly except for the lock screen does not increment the tally. The lock screen is controlled by gnome-screensaver, where the login/switch user screen is controlled by lightdm. Your issue may be similar where the first time after a reboot you are using lightdm, and later attempts are using the lock screen.
– Andrew Vian
May 11 '17 at 21:14










1 Answer
1






active

oldest

votes

















up vote
0
down vote













I had same experience. And I solve it as below.




  1. vim [/etc/pam.d/login]
    not the [/etc/pam.d/common-auth]



  2. Add the following lines.
    auth required pam_tally2.so deny=4 even_deny_root unlock_time=1200




    • deny=4 (lock the account after 4 failed logins)

    • even_deny_root (Root account will be locked as well)

    • unlock_time=1200 (unlocked after 20 minutes)




  3. Reference




    • My Ubuntu : Ubuntu 16.04.5 LTS

    • Command : man pam_tally2








share|improve this answer





















  • Hi. Where in the /etc/pam.d/login file do you put this line? Order is very important in pam and you can't just put it anywhere. Also, in my login file I have the following line: @include common-auth which is an import line that imports my contents from the common-auth file so essentially those contents are already in /etc/pam.d/login
    – liquidoshin
    Dec 5 at 17:52













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f857788%2fpam-tally2-not-locking-user-out-after-failed-attempts-on-ubuntu-14-and-16%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













I had same experience. And I solve it as below.




  1. vim [/etc/pam.d/login]
    not the [/etc/pam.d/common-auth]



  2. Add the following lines.
    auth required pam_tally2.so deny=4 even_deny_root unlock_time=1200




    • deny=4 (lock the account after 4 failed logins)

    • even_deny_root (Root account will be locked as well)

    • unlock_time=1200 (unlocked after 20 minutes)




  3. Reference




    • My Ubuntu : Ubuntu 16.04.5 LTS

    • Command : man pam_tally2








share|improve this answer





















  • Hi. Where in the /etc/pam.d/login file do you put this line? Order is very important in pam and you can't just put it anywhere. Also, in my login file I have the following line: @include common-auth which is an import line that imports my contents from the common-auth file so essentially those contents are already in /etc/pam.d/login
    – liquidoshin
    Dec 5 at 17:52

















up vote
0
down vote













I had same experience. And I solve it as below.




  1. vim [/etc/pam.d/login]
    not the [/etc/pam.d/common-auth]



  2. Add the following lines.
    auth required pam_tally2.so deny=4 even_deny_root unlock_time=1200




    • deny=4 (lock the account after 4 failed logins)

    • even_deny_root (Root account will be locked as well)

    • unlock_time=1200 (unlocked after 20 minutes)




  3. Reference




    • My Ubuntu : Ubuntu 16.04.5 LTS

    • Command : man pam_tally2








share|improve this answer





















  • Hi. Where in the /etc/pam.d/login file do you put this line? Order is very important in pam and you can't just put it anywhere. Also, in my login file I have the following line: @include common-auth which is an import line that imports my contents from the common-auth file so essentially those contents are already in /etc/pam.d/login
    – liquidoshin
    Dec 5 at 17:52















up vote
0
down vote










up vote
0
down vote









I had same experience. And I solve it as below.




  1. vim [/etc/pam.d/login]
    not the [/etc/pam.d/common-auth]



  2. Add the following lines.
    auth required pam_tally2.so deny=4 even_deny_root unlock_time=1200




    • deny=4 (lock the account after 4 failed logins)

    • even_deny_root (Root account will be locked as well)

    • unlock_time=1200 (unlocked after 20 minutes)




  3. Reference




    • My Ubuntu : Ubuntu 16.04.5 LTS

    • Command : man pam_tally2








share|improve this answer












I had same experience. And I solve it as below.




  1. vim [/etc/pam.d/login]
    not the [/etc/pam.d/common-auth]



  2. Add the following lines.
    auth required pam_tally2.so deny=4 even_deny_root unlock_time=1200




    • deny=4 (lock the account after 4 failed logins)

    • even_deny_root (Root account will be locked as well)

    • unlock_time=1200 (unlocked after 20 minutes)




  3. Reference




    • My Ubuntu : Ubuntu 16.04.5 LTS

    • Command : man pam_tally2









share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 29 at 5:24









user898055

1




1












  • Hi. Where in the /etc/pam.d/login file do you put this line? Order is very important in pam and you can't just put it anywhere. Also, in my login file I have the following line: @include common-auth which is an import line that imports my contents from the common-auth file so essentially those contents are already in /etc/pam.d/login
    – liquidoshin
    Dec 5 at 17:52




















  • Hi. Where in the /etc/pam.d/login file do you put this line? Order is very important in pam and you can't just put it anywhere. Also, in my login file I have the following line: @include common-auth which is an import line that imports my contents from the common-auth file so essentially those contents are already in /etc/pam.d/login
    – liquidoshin
    Dec 5 at 17:52


















Hi. Where in the /etc/pam.d/login file do you put this line? Order is very important in pam and you can't just put it anywhere. Also, in my login file I have the following line: @include common-auth which is an import line that imports my contents from the common-auth file so essentially those contents are already in /etc/pam.d/login
– liquidoshin
Dec 5 at 17:52






Hi. Where in the /etc/pam.d/login file do you put this line? Order is very important in pam and you can't just put it anywhere. Also, in my login file I have the following line: @include common-auth which is an import line that imports my contents from the common-auth file so essentially those contents are already in /etc/pam.d/login
– liquidoshin
Dec 5 at 17:52




















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f857788%2fpam-tally2-not-locking-user-out-after-failed-attempts-on-ubuntu-14-and-16%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

Eduardo VII do Reino Unido