So, I started up my WordPress VM I created in these posts:

…and and found that there where some updates to plugins and WordPress itself. The only problem was that I couldn’t get FTP to work!

It turns out that we need to create an FTP server! A common one that many people seem to be using is vsftpd (Very Secure FTP Daemon). Here’s how to install it:

sudo apt-get install vsftpd

… that was pretty straight forward… yes, but we aren’t finished yet. We now need to edit the configuration file. After any changes to the configuration you will need to restart vsftpd for them to take affect. You can edit the vsftpd config like this:

sudo vim /etc/vsftpd.conf

The biggest change you need to make is to switch the Anonymous_enable from YES to NO (I think this was already the default for me):


Prior to this change, vsftpd allowed anonymous, unidentified users to access the server’s files. This is useful if you are seeking to distribute information widely, but may be considered a serious security issue in most other cases.

After that, uncomment the local_enable option, changing it to yes and, additionally, allow the user to write to the directory.


Finish up by uncommenting command to chroot_local_user. When this line is set to Yes, all the local users will be jailed within their chroot and will be denied access to any other part of the server.


I preferred not to do this so it lets me see all the files on the server – I am admin after all ;).

FTP uses port 21 as its control port, so we need to add a port forwarding rule to our VirtualBox configuration:

However after restarting the service we’re still getting problems…

Because of a recent vsftpd upgrade, vsftpd is “refusing to run with writable root inside chroot”.
This is due to the following update:

– Add stronger checks for the configuration error of running with a writeable
root directory inside a chroot(). This may bite people who carelessly turned
on chroot_local_user but such is life.

So, we need to remove write access to our home directory (you might want to create a user specifically for FTP):
chmod -w /home/user/

Then, as always, restart:

 sudo service vsftpd restart

We aren’t getting a critical error from FileZilla anymore but its still not working!

It turns out that “simple port forwarding is not enough for FTP. FTP has a control connection on (usually) port 21… But to transfer files or directory listings FTP opens another connection. There are two ways to open this connection. The most common is to use passive mode (as opposed to active):

  • Passive mode: “In this case the FTP server allocates a random port on the server and tells the client IP and port using the response to the passive command.”

“Make sure port 20, 21 and few more ports, for example 4242-4243, are being forwarded to the server. We will need these extra ports for passive mode – set pasv_min_port and pasv_max_port accordingly in the configuration file:
connect_from_port_20=YES #this should already be somewhere in the config file

Restart vsdtpd and add the ports you used to your VM:

If you run FileZilla you should now be able to connect!

But WordPress still isn’t happy 😦
I’m “unable to locate the WordPress Root directory.”

 This is because we haven’t set the root FTP directory to the location where WordPress is installed. We can fix this by adding the following to the config file:

Restart the daemon and you should be good to go!


Wait a Second….

To connect to your server with FTP, no extra configuration is necessary. OpenSSH gives you “free” FTP via the SFTP (SSH FTP) protocol. Most clients (FileZilla, for example) support it; just choose SFTP as the protocol, localhost as the server with port 2222, and your Ubuntu username and password. Choose /var/www/ as the default directory, and you should be able to transfer files to and from your server.

Let’s test that everything is working: create a php file named info.php containing the usual phpinfo call:




Use your FTP client to upload that file to your server’s /var/www/ folder. Now point your browser to http://localhost:8888/info.php, and you’ll see the PHP info page. The System row at the top of the table will tell you PHP is running on Ubuntu.

There you have it! You can test server configurations, brush up on your sysadmin skills, and develop your web sites and applications in a full Linux server environment running inside your usual desktop.