The ftp account is correct, but failed to get directory list: “Could not retrieve directory listing”. Strange, isn’t it?
At first, I thought it was something wrong with the ftp add user script. So I tried to do it manually but still didn’t work.
After a one-hour research, here is the answer: I should use passive mode. And for Pureftpd to run on passive mode, I should open more ports to the public. So this is mainly a firewall issue.
Update the pure-ftpd.conf:
PassivePortRange 20000 30000
I don’t really need that much ports open to the public. Let’s narrow it down.
Then, adjust the aws firewall rules accordingly.
Restart the pureftpd, and you’re done.
By the way, it’s easy to set up permissions for pure-ftpd. The script from oneinstack provides a very good example:
$FTP_bin useradd $User -f $Passwdfile -u $run_user -g $run_user -d $Directory -m < $FTP_tmp_passfile $FTP_bin mkdb $Puredbfile -f $Passwdfile > /dev/null 2>&1
If you’re using www for nginx, set $run_user=www, so that the pureftpd will also run as www. As easy as that.