Howto generate password for proftpd mod_sql_passwd

2012-01-10
As I spent a few hours with figuring out on how to generate passwords which are usable with the mod_sql_passwd module in proftpd, I’d like to share how to do this. I am using the username as a salt, if you don’t want a salt, just drop it from the echo.

# md5 hex encoded
# SQLPasswordEncoding hex
# SQLAuthTypes MD5
# SQLPasswordUserSalt name Prepend
# salt == username, password == password
/bin/echo -n "usernamepassword" | openssl dgst -hex -md5
d51c9a7e9353746a6020f9602d452929

# md5 HEX encoded
# SQLPasswordEncoding HEX
# SQLAuthTypes MD5
# SQLPasswordUserSalt name Prepend
# salt == username, password == password
/bin/echo -n "usernamepassword" | openssl dgst -hex -md5 | tr [:lower:] [:upper:]
D51C9A7E9353746A6020F9602D452929

# sha256 base64 encoded
# SQLPasswordEncoding base64
# SQLAuthTypes SHA256
# SQLPasswordUserSalt name Prepend
# salt == username, password == password
/bin/echo -n "usernamepassword" | openssl dgst -binary -sha256 | openssl enc -base64
vtklQtp0DL5YesRbeQEgeheiVjaAss7aMEGVonM/FL4=
The other variants are similar. Two important things: you need echo -n as that removes the newline from the echo command and if you use base64, you need the binary digest - for md5 and all the sha variants. This is somehow not needed for the hex and HEX encoded passwords. I hope someone finds this (at all and) useful.

Geschrieben um 12:07

[/computer] [permanent link] [Startseite]

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.0 Germany License.