Is it possible to let a python program execute only if a wrong password is given at the login screen of my raspberry pi?

  • Hi and welcome to the site. I'm afraid your question is very unclear. What password? Why would the program require it? How is the password provided? When is it given? Do you mean at login? Who checks it? What is the python script supposed to do? Do you mean you want to launch an application only if a wrong password is given? Would this be via sudo? Please edit and clarify your question. – terdon Oct 31 '14 at 13:36
  • You might try looking into using fail2ban to do something like this via actions. – Bratchley Oct 31 '14 at 14:14

Have a look at libpam-script. It allows you to execute scripts during authorization, password changes and sessions.

To meet your need, you can build a PAM configuration (in /etc/pam.d/<whatever>) that arranges for this module to execute right before pam_deny only if the normal sequence of modules denies the login.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.