By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,990 Members | 1,741 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,990 IT Pros & Developers. It's quick & easy.

mysql password() & unix crypt password...

P: n/a
Hello all,

I am creating a user administration system where system administrator
can activate services for a user, like webspace, a mail account or a
subdomain.

I now want to create a function that creates mysql databases and grant
the right privileges to a user. But the problem is that mysql wants to
have the plaintext password for the user in the "grant ... identified by
'pwd'" field, or in a manual query to update the password in the
mysql.user table with PASSWORD('pwd').

I have another database which holds the passwords for the users, these
password are stored the moment a user signs up and are used to activate
services, for example ssh access to the machine. The stored passwords
are encrypted using crypt(). So for adding a ssh service to a user, I
simply do echo "$user:$pwdhash" | chpasswd -e.

I have chosen crypt because some programs (like proftpd) don't take md5
sums.

The problems is that I don't have the plaintext password. So I cannot
add a mysql db.

So I need to create a user in mysql with a crypt password.
I tried to just "grant all privileges ... identified by 'nothing'"
and then afterwards update the mysql.user table and putt the crypt
password in there but it doesn't work like that.

Does anyone have any idea on how I could fix this, how can I create a
user in mysql without having his plaintext password and only having a
crypt hash of it.

I thought about not only storing a crypt hash, but also an md5 hash and
a mysql PASSWORD() hash.. but I think that's an ugly solution.

I hope I was clear enough.

Thank for any answer you can give me,

Aaron

Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.