You can just put the username and password in the MySQL database as normal
text, then build your applications that are reading them to check the
passwords with the UNIX Crypt function.

In other words, just as your passwords are stored in a plain text file,
store them in plain text in the db.  Then to confirm them, take the first 2
characters of the crypted password, use them as the salt to crypt the
password the user entered, and compare the results.  If that are the same,
they entered a valid password.

I guess I'm assuming your existing passwords are in crypt format, but the
same process is probably possible with whatever format they are in.


Peter Janett

New Media One Web Services
New Upgrades Are Now Live!!!
Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1
Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25,
Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43
PostgreSQL coming soon!

----- Original Message -----
From: "Scott" <[EMAIL PROTECTED]>
Sent: Friday, October 04, 2002 4:43 AM
Subject: [PHP] Unix passwd file

> I apologize if this is might be OT.  I have 5,000+ users in a unix passwd
> file that I would like to move to a MySQL table to build a login system
> with php.  I could then use this table for Postfix and Radius.  I know
> about the getpwent in perl, but does anyone know if I populate a MySQL
> table with the login/password can php then use that encrypted password to
> validate users?
> --
> PHP General Mailing List (
> To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to