Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

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)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.