1

I have a KVM guest that I need to reset the password. If I use 'virsh console' to access the guest account, I'm able to update the shadow file with a new hash line like '$6$avdwsefs$In0A44PGN3xHczlF4qeF5wrVs6WmeCfTUYB1WZ1g6Co.fq62l5/0ZbrnGWbjhRQT598eAKDo/nMaW6iJCA3k2.'. If I reboot the guest account, the new password works. But if I mount the guest system in server and update the shadow file in /mnt directory, the password won't work. Both the old password hash and new password hash won't work after I modify shadow file in the mounted directory.

Update: Both the server system and vps guest system have centos6.4 and the latest update of glibc.

1 Answer 1

2

The password hashes are encrypted with crypt(3).

Make sure that the glibc is supporting SHA-512 encryption. E.g. you have glibc 2.7 or newer. Otherwise those hashes will be ignored by crypt.

From the crypt(e) man page:

The glibc2 version of this function supports additional encryption algorithms.
If salt is a character string starting with the characters "$id$" followed by a string terminated by "$":
$id$salt$encrypted

...

ID | Method
1 | MD5
2a | Blowfish (not in mainline glibc; added in some Linux distributions)
5 | SHA-256 (since glibc 2.7)
6 | SHA-512 (since glibc 2.7)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .