1752782 Members
6392 Online
108789 Solutions
New Discussion

Password checking

 
Karthick K S
Frequent Advisor

Password checking

Is there possible to check password for user login validation in login script and tell me the example
1 REPLY 1
Doug O'Leary
Honored Contributor

Re: Password checking

Hey;

If I'm understanding you correctly, you can do the same thing any UNIX system does when it verifies identify on login.

1. Obtain the encrypted password from the password file (getpwent)

2. Obtain the password from the user. Encrypt the user-supplied password using the same salt as was used with the encrypted password. (crypt)

3. Do a simple string comparison of the two encrypted pwds. If they're equal, they're the same password; otherwise, the user entered the wrong password.

HTH;

Doug


------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html