I load a script in .bash_profile and this script will ask for right password whenever a user opens a terminal window. If the user enters a wrong code, the scrip
.bash_profile
You can always trap SIGINT:
SIGINT
trap 'echo got SIGINT' SIGINT
Once you're done, reinstall the default handler again with
trap SIGINT
See the POSIX spec for trap for details. This works in all Bourne shells, not just bash.