Link to home
Start Free TrialLog in
Avatar of projects
projects

asked on

htpasswd to mysql table

Can't seem to find this anywhere on the net so time to ask.

How can one take the contents of an htpasswd file and convert it to username/password in a mysql table.
Avatar of gheist
gheist
Flag of Belgium image

Do you want to use that for authentication against MySQL, or just store file data in a table with two columns?
Avatar of projects
projects

ASKER

Right, just the two columns, username and password, so I can use apache/mysql auth instead of htpasswd file.
Sorry, I've no idea what the link information means. I know it's to load a file but can you give me an example instead of a link. I searched and tried various things but I'm not a programmer so need more detail.

Thanks.
My htpasswd file is pretty small so I could replicate it by hand but I can't find any info on how to create encrypted username/passwords to be stored in mysql. Seems I would need a bash or php script or something to do this.

What I have found so far simply create non encrypted accounts into the mysql table using normal mysql commands. I'd like those to be encrypted in the db along with some plain text ones.
Do you have httpasswd with plain passwords like netware?
Netware? I've not heard that term since the 80's :).

Anyhow, I've re-created all of my users/passwords in a mysql table so now I just need to figure out the stupid changes with centos7 to get this working since mod auth mysql is now deprecated.
To encrypt salted passwords
openssl passwd -help

-1 -5 -6 are nearly universally supported.
Basically, this question is already answered at this point. The question was how to import htpasswd file into a mysql table so I could start using apache mysql auth.

The answer was that I had to re-create all of the accounts manually since I could not find a way of converting/importing the existing htpasswd file into the new mysql table.

My next problem (question?) however will be that of modifying apache to use the new table instead of the .htpasswd file. So far, that seems to be a confusing topic to many because some mods have been deprecated, etc.
ASKER CERTIFIED SOLUTION
Avatar of gheist
gheist
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think I left unnecessary space before echo - check the file, there should be no space after colon.