Skip to content

Instantly share code, notes, and snippets.

@devded
Last active May 7, 2026 21:09
Show Gist options
  • Select an option

  • Save devded/44adc7c4ce133a274f624106887d2f04 to your computer and use it in GitHub Desktop.

Select an option

Save devded/44adc7c4ce133a274f624106887d2f04 to your computer and use it in GitHub Desktop.

Reset Linux user password (bypass PAM pwquality)

When passwd or chpasswd rejects a weak password due to PAM policy, hash it directly with SHA-512:

echo "USERNAME:NEWPASSWORD" | sudo chpasswd -c SHA512

This skips the PAM password stack and writes the hash straight to /etc/shadow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment