In the never-ending search for the perfect blog theme I decided to get the WordPress automatic theme install stuff working on the EC2 instance that hosts this blog. This involved setting up and FTP server on the instance.
A quick search in the package manager found pure-ftpd, so i installed the package. I googled around to figure out how to configure pure-ftpd. This was a snap, and my test FTP session worked! However, when i sent to install a WP theme it always failed! What gives?!
After turning on verbose logging in pure-ftpd and tailing
I saw something like this at the end of the log:
pure-ftpd: (firstname.lastname@example.org) [DEBUG] Command [pasv] 
pure-ftpd: (email@example.com) [DEBUG] Command [list] [-la /var/www/htdocs/myblog]
I had to do a bit more googling to brush up on my rusty knowledge of the <a FTP protocol, but what was happening here is that the client (WordPress theme installer) is failing to list the files in the folder because it has activated Passive Mode.
The first step was to edit my EC2 Instance to allow the ports specified in my
pure-ftpd.conf file. You can find these values out by looking for this in your conf
PassivePortRange 50000 50100
So I updated my EC2 instance to allow these ports, but it was still failing! I furiously search the
internet for a clue and finally found one in a blog post about
setting up proftpd on EC2. The
one thing i was missing was forcing the second connection made by the client in Passive Mode to use
my EC2 instance's public IP address. The fix was a simple as uncommenting and editing the
following line in
pure-ftpd.conf and restarting the daemon:
# Force an IP address in PASV/EPSV/SPSV replies. - for NAT.
# Symbolic host names are also accepted for gateways with dynamic IP
Once this was set up themes, plugins, and updates all started to install perfectly! Hopefully anyone else who runs into this issue finds this post and avoids the headache that it caused me!