WordPress has a convenient feature for updating itself and plugins through the Dashboard. Unfortunately it doesn’t support SFTP (SSH FTP), which would be provided by the excellent OpenSSH package. Instead, you’ll need to set up an FTPS (FTP over SSL) server. This short tutorial will guide you through installing a secure FTPS server on Ubuntu 11.10.
Step 1: Install vsftpd
APT (Advanced Packaging Tool) is the software package manager for Ubuntu.
> sudo apt-get install vsftpd
Step 2: Shut down vsftpd
The service will be started immediately after installation. For security reasons, we will shut it down until it is properly configured.
Step 3: Configure vsftpd
Edit /etc/vsftpd.conf and make these suggested changes and additions.
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
anon_world_readable_only=NO
anon_upload_enable=NO
anon_mkdir_write_enable=NO
connect_from_port_20=NO
listen_port=2112
Step 4: Restart vsftpd
Now that anonymous access has been disabled and SSL has been enabled, the FTPS service can be restarted.
Step 5: Create FTPS user
It’s a good idea to create a separate account for updates through the WordPress dashboard. For simplicity, I created a system account with the same username I use for the WordPress admin account. In this example I’m using “ftps”; use whatever username works best for you. The last argument must be the path to the web server directory; ignore the warning about the home directory not belonging to the user. Be sure to give the account a strong password.
Step 6: Add the FTPS user to the www-data group
The new user will need to belong to the www-data group. Again, I’m using “ftps” as the example username.
www-data:x:32:ftps
Step 7: Give the www-data group read/write access
The www-data group will need read/write access to the web server directory.
> sudo chmod -R g+w /srv/www