Setting up FTP for Wordpress automatic updates
Since before yesterday, WordPress had to be manually updated. I hadn't been able to set it up so that I could update through the WordPress dashboard interface. I finally got around to making the "auto-update" work, so I no longer have to do manual updates. I also wrote a simple bash script to back up the database and the WordPress directory. Here are some short steps I had to figure out to get it all working...
To get the FTP up and running, I needed:
- A separate username for WordPress, on the WordPress interface (in the Users section, site/wp-admin/users.php).
- The same username on the server.
- The home directory for this WordPress user (set in /etc/passwd) had to be the WordPress installation directory (i.e., where wp-content, wp-config.php, etc., are contained), and furthermore all files in the WordPress directory had to be owned, and writable, by the WordPress user. I used chmod -R and chown -R (recursive) to implement this.
This of course also assumes that an ftp daemon is installed on the server. I used vsftpd; configuration was simple, and all I needed to do was make it so users could write to there home directory (something like writable=yes in the config file). To test my set up, I would FTP into my server as the WordPress user. Once I had it set up so that the WordPress user was in the WordPress directory upon login, and could create and delete files, everything worked great.
Again, steps #1 and 2 above are critical; when you are logging in to FTP through the WordPress site for auto-update, it must be the SAME user as on the server (e.g., a WordPress user, in site/wp-admin/users.php named "blah123" AND a Linux user, in /etc/passwd, named "blah123."
It was so nice to finally have this done! It makes the update process much easier to manage.