Problems? Is your data what you think it is? | |
PerlMonks |
Matching encrypted passwordsby perlmoi (Initiate) |
on Dec 26, 2013 at 18:24 UTC ( [id://1068447]=perlquestion: print w/replies, xml ) | Need Help?? |
perlmoi has asked for the wisdom of the Perl Monks concerning the following question: Greetings Monks, Hopefully someone with a bit more robe ruffling experience than I can weigh in here... I'm trying to match encrypted passwords in /etc/shadow (edit: actually stored in a DB, encrypted passwords only) with those programatically generated using Crypt::Password, but I must be missing something (eg, what salt is used in Linux when the password command is used to set/change the password. edit: I started scanning the passwd(1) source to get a clue, but started to feel nauseous either from the code, or from christmas chow, not sure which) eg, given the following /etc/shadow entry (user 'bob', password 'abc'):
I now to try to replicate that password using this code ($1 implies MD5):
Which yields:
...Obviously not a match Am I on the right track here? Is this a case of not using the same salt string? FYI, I need this to authenticate users which are being migrated from an /old/ server to a new one, and we only have the encrypted passwords, so I need to authenticate them with new proposed systems... I'd appreciate pointers in what I'm doing wrong here. Thanks a mill.--------------------------- Documenting answer: Abbot ambrus on chatterbox says pass the entire encrypted string as salt (lib will know how to parse it): thanks!!
Back to
Seekers of Perl Wisdom
|
|