[Samba] user password hash

Rowland penny rpenny at samba.org
Thu Oct 10 13:35:19 UTC 2019


On 10/10/2019 13:51, L.P.H. van Belle via samba wrote:
> Rowland,
>
> Can you test this:
>
> echo -n $(ldbsearch -H /var/lib/samba/private/sam.ldb -b 'dc=CHANGE_BASE' -s sub '(&(objectclass=user)(samaccountname=CHANGE_USERNAME))' unicodePwd |grep unicode |awk '{ print $NF }') | base64 -d -w 0 | iconv -t UTF-8 -f UTF-16LE
>
> The results are chinees characters.

Interesting, initially I got 'iconv: illegal input sequence at position 
0' until I added hexdump -e '/1 "%02X"':

echo -n $(ldbsearch -H /var/lib/samba/private/sam.ldb -b 
'dc=samdom,dc=example,dc=com' -s sub 
'(&(objectclass=user)(samaccountname=rowland))' unicodePwd |grep unicode 
|awk '{ print $NF }') | base64 -d -w 0 | hexdump -e '/1 "%02X"' | iconv 
-t UTF-8 -f UTF-16LE

I now get the Chinese characters

However, I have tried several times to decode a unicodePwd, but have 
never succeeded ;-)

Rowland


> But if i put it in the example you showed, it shows the correct things.
>
> Greetz,
>
> Louis



More information about the samba mailing list