• Post Reply Bookmark Topic Watch Topic
  • New Topic

htpasswd file  RSS feed

Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have this JSP form, where onload i'm capturing the staff number of the user and on submit i want the user to enter their password

This password is stored in the htpasswd file on the server.

The passwords are encrypted using MD5 algorithm which is modified for apache.

How can i authenticate the users upon submit??

I have found out the below:
1. when i give the command : /htpasswd username password
gives me a different encryption each time. So, i cannot use the standard MD5 encrytion to encrypt and compare.

On this website :http://httpd.apache.org/docs-2.0/programs/htpasswd.html
i found out that the htpasswd have different exit status. I'm quoting the below from this website itself...

htpasswd returns a zero status ("true") if the username and password have been successfully added or updated in the passwdfile. htpasswd returns 1 if it encounters some problem accessing files, 2 if there was a syntax problem with the command line, 3 if the password was entered interactively and the verification entry didn't match , 4 if its operation was interrupted, 5 if a value is too long (username, filename, password, or final computed record), 6 if the username contains illegal characters (see the Restrictions section), and 7 if the file is not a valid password file.

The exit status 3 is the one that i'm looking for, but i don't know what command line shall i give to compare passwords for users.
Can any one help me out on this one.

If i have posted the question in wrong forum, please transfer this question to the right forum.

Thanks in advance
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!