Pádraig Brady wrote:
> Thomas Pedoussaut wrote:
>> It's been years since I used crypt for my passwords.
>>>> Now I've to build some tools to manipulate another shadow-like database
>> for dovecot, and I can't find how to encrypt my passwords. The result
>> looks like $1$UYiAOVKB$OPYATv8K8HliDjWVLx1eQ0
>> For the moment the crypt function of php does the job, but I'd like to
>> find something more command-line oriented as 'passwd' doesn't support
>> alternatives shadow-file.
>>>> Any help appreciated as Mr Google is a bit useless.
>> mkpasswd "password" -Hmd5
I just noticed that mkpasswd is non standard. The command above works
on debian, as there, mkpasswd comes from the whois package.
On fedora at least, mkpasswd is part of the expect package
and just generates random passwords.
Now glibc can directly generate the MD5 format password hashes
you described, if you prepend $1$ to the salt parameter
of the crypt function. So the following should work
on glibc systems:
echo 'import crypt; print crypt.crypt("password","$1$salt")' | python
I presume you can do the equivalent from the command line with the PHP interpreter.
Also wikipedia gives reasons why crypt(1) is not on linux:
http://en.wikipedia.org/wiki/Crypt_(Unix)#crypt.281.29_under_Linux
Pádraig.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!