Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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 | 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

Your Answer


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.