I want to include the following PIN feature which can be used for authentication in Ubuntu 17.10 (both in a terminal session and during the login screen). Once an authentication string is entered, Ubuntu will check to see if it is "equal" to the encrypted password or to the encrypted PIN. It will authenticate. If not, the system will suspend the PIN feature until a successful authentication event has happened.
- Can I write a script that has access to entered authentication strings, at least during the login screen?
- Can I modify the existing Ubuntu scripts? If so, which ones?
- Can I use the underlying password encryption mechanism for my PIN? If not, how can I get started on writing an encryption algorithm to store and recover PINs and passwords?
Quick Answer: No you can't, not simply anyways. This would not be a script change it would be a large amount of very complex C/C++ codebase alterations.
Longer answer: I think "can I write software to do X" is beyond the scope of this site.
If you are a developer with the skill to do this, I would go join a mailing list for one of the display manager of your choice, like lightdm or gdm, and ask about development of this feature.
In my survey of Linux display managers none of them support this, and adding this would involve making deep changes inside the display manager software. This software is probably mostly written in C and C++.