After user password change the size of salt decreased in RHEL/Centos 6, eg:
cat /etc/shadow
...
root:$6$FkMNsNxT$FW77....................nbL0......
bin:*:15422:0:99999:7:::
...
As you can see, FkMNsNxT is 8 characters.
Why it happens? In the beginning, after installation, the size is 16 chars.
sha512crypt
which is what the current password is encoded with (seeman 5 crypt
). – Kusalananda Aug 17 '21 at 17:00foobar
:$6$abc$cyugVWWBuhMmAXlbiQBF7DHoFwA0ff6g9AF6j6N1EKMUXHyGGvjkzhQdzV13AFJpV7xnnx8eC.f372Ypp1Zug.
– ilkkachu Aug 17 '21 at 18:30crypt(5)
manual wrong when it says thatsha512crypt
uses a variable salt of between 6 and 96 bits (less than 128 bits). The entry that you show seems to be using a 24 bit salt (theabc
value). – Kusalananda Aug 17 '21 at 18:32$
,:
and newline are used as separators in/etc/shadow
and other control chars might also cause issues. I tested that with Perl, and it cuts the salt at 16 chars (but didn't enforce the base64 alphabet, allowing hashes like$6$!!!$
, but they didn't work with the actual PAM module) – ilkkachu Aug 17 '21 at 18:41./0-9A-Za-z
vs. the more standardA-Za-z0-9+/
, so the order is different too, not just the two special chars) – ilkkachu Aug 17 '21 at 19:05