vsftpd will not accept passwords encrypted with MD5
htpasswd
generates MD5 hashes in the Apache format, which you can verify by seeing that they start with $apr1$
, but PAM only supports formats that your platform's implementation of crypt(3)
implements. For Glibc, the equivalent (MD5-based) would be $1$
. You just need to generate the passwords with a different tool. Here's an example:
sh$ openssl passwd -1
Password:
Verifying - Password:
$1$vhzHvIYn$2Ro.R0WdLnxrWjHcs5RbA/
You can copy this hash into your ftpd.passwd
file in the username:hash
format, and it should work.
Expanding on @bonsaiviking's answer you can generate the openssl md5 password and add it to the ftpd.passwd file in one line using htpasswd's batch mode -b, and plaintext -p options as follows:
htpasswd -c -p -b ftpd.passwd *username* $(openssl passwd -1 -noverify *password*)
The example above (Ubuntu) also creates a new ftpd.passwd file if it doesn't exist using -c