On most modern Unix systems, you need super user privs to be able to do that. Encrypted passwords are stored in /etc/shadow, which has a 0400 permission. I would create a small C program doing the testing (reading the password from a file descriptor - stdin will do fine) using exit to do the success/failure checking. Install the binary suid root.