Hi, I'm looking at creating md5 passwords in ruby then manually
replacing the users pass in the /etc/shadow file. I unfortunately cannot
use the ruby-password or ruby-termios libraries as they are not in the
Debian-stable tree (long story).
I looked in the source for ruby-password and noticed that if the salt
supplied for crypt is $1$, the returned string is an md5 digest.
Unfortunately this does not work
crypt_pass = password.crypt("$1$as")
the resulting does not have enough chars
Can you show me your output?
It works for me:
[ianmacd@foobar]$ irb
irb(main):001:0> require 'password'
=> true
irb(main):002:0> "foo".crypt('$1$abcdefgh')
=> "$1$abcdefgh$XxzGe9Muun7wTYbZO4sdr0"
A smaller salt works, too:
irb(main):003:0> "foo".crypt('$1$ab')
=> "$1$ab$KdoFYgkGJOZ629oOkVUuD."
Ian
--
Ian Macdonald | Learn from other people's mistakes, you
System Administrator | don't have time to make your own.
(e-mail address removed) |
http://www.caliban.org |
|