Customize "change password" in unix shell

I want to customize the "change password" through unix shell. when a user's password is expired and he/she logs into shell next time he/she will be asked to change his/her password. At this time when the user provides new password instead of unix doing the "password change" action I want to call my script/binary to do the same.

How do I do it?

Hmm. Sounds like a hacker program suite. You would have to replace so many programs that it would become a huge task.
Do you have a particular commercial problem to solve?
What would your program suite need to do that the system-supplied tools do not do?

you can maybe write specific script and place in your global (/etc/profile)..
this script must check expire times and run before unix tool (for ex 1 day ago) and add [trap "" 2] to profile..
after you can determine expire day from shadow or passwd or usermod tools (according to depend your system ) or any tool and if day is 1 day ago from now then script runs..

ygemici

If you are into C programming, I would recommend googling for PAM (Pluggable Authentication Modules) and bringing down the source to the Linux modules. If you are not into C programming, I think you have a challenge on your hands.

Cheers

I agree, scripting a solution sounds much better than trying to write your own password binaries!