[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: Kickstart User Creation



On Tue, 29 Apr 2003, John wrote:

>I used this code:
>summer Numbat:~$ cat bin/pw.encrypt
>#!/usr/bin/perl -w
>$passwd = $ARGV[0];
>$salt = "\$1\$".$ARGV[1]."\$";
>
>print(crypt($passwd, $salt)."\n");
>
>to generate encrypted passwords for one of the accounts here, and it
>doesn't match what is actually used.

That worked when I wrote it. Let's try with your example:

># echo fred | passwd --stdin fred
># grep fred /etc/shadow
>fred:$1$iyQ05jRt$iMf.XwnD7iUhI3Tv45ZPI.:12171:0:99999:7:::

$ ./mycrypt.pl fred iyQ05jRt
$1$iyQ05jRt$iMf.XwnD7iUhI3Tv45ZPI.

># echo fred | passwd --stdin fred
># grep fred /etc/shadow
>fred:$1$le3EjRvD$CDd82emph.w1nTPnW0k5z1:12171:0:99999:7:::

$ ./mycrypt.pl fred le3EjRvD
$1$le3EjRvD$CDd82emph.w1nTPnW0k5z1

Still works (phew).

>Different encrypted passwords!!

Yes, that's the whole point of salt.


Cheers,
Phil





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]