Generating password hashes with OpenSSL

It is sometimes convenient to generate crypt or MD5 passwords for use in /etc/shadow (or other applications) without running passwd and checking for the encrypted hash in /etc/shadow.

Default Unix password algorithm:
$ openssl passwd -crypt "password"

MD5-based password algorithm:
$ openssl passwd -1 "password"

Depending on your system, default (crypt) passwords may only be significant to 8 characters. MD5-based passwords can be up to 256 characters in length. To use MD5-based passwords on Red Hat systems, make sure USEMD5=yes appears in /etc/sysconfig/authconfig.

Back to
Last modified: 2007/01/23