Can I edit login script? For I want to restrict the user to only have 3 login attempts. If the user fails to login in after 3 attempts, the system must shutdown.
Is this possible?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
This line should let someone have 3 attempts. It also unlocks after 21600 seconds (=6 hours).
auth required pam_tally.so onerr=fail deny=3 unlock_time=21600
This will not shut down your system but have the user stay at the login screen with a notice (s)he can not login. I have not yet see a method where you can shut the system down after 3 failed loging attempts.
I'm not sure if you can shutdown the system from PAM. You need something where you can call your own custom script when the user fails to log in.
Take a look at fail2ban, that looks like you can set up a custom action.