I have WordPress 3.6 running on ubuntu 12.04 LTS with apache2. WordPress is running out of the root directory on apache, ie. /var/www
I have an FTP server setup (VSFTPD). I have it set to chroot to the home directory of FTP users.
I have a single FTP user set up, with a folder in the home directory called public_html. In there, I have mounted /var/www so that user can access the root directory on apache.
I have a UMASK of 002 set on VSFTPD and dr-xrwsr-x on /var/www. All directories in /var/www are 775 and all files are 664.
I can log into the ftp server with the ftp user and create, overwrite and delete files and folders wherever I like in /public_html, as expected.
If I use wordpress to install a plugin with the same ftp credentials, it fails with Unable to locate WordPress Content directory (wp-content).
I checked the wp-config.php documentation, it said to add in FTP_BASE
to my config, which I did like so:
define('FTP_BASE', '/public_html/');
I restarted apache and logged out and back in to wordpress. The plugin install still fails with the same message.
If I turn on protocol debugging in VSFTPD (log_ftp_protocol=YES
), I can see wordpress logging in to VSFTPD, but it never changes directory to /public_html, despite FTP_BASE being set in my config.
What is weird, is it does try and CD to /var/www/wp-content, which obviously won’t work. What is going on? Is WordPress ignoring my FTP_BASE
?
My vsftpd log:
Sat Sep 21 04:16:15 2013 [pid 2] CONNECT: Client "w.x.y.z"
Sat Sep 21 04:16:15 2013 [pid 2] FTP response: Client "w.x.y.z", "220 (vsFTPd 2.3.5)"
Sat Sep 21 04:16:15 2013 [pid 2] FTP command: Client "w.x.y.z", "USER ftpuser"
Sat Sep 21 04:16:15 2013 [pid 2] [ftpuser] FTP response: Client "w.x.y.z", "331 Please specify the password."
Sat Sep 21 04:16:15 2013 [pid 2] [ftpuser] FTP command: Client "w.x.y.z", "PASS <password>"
Sat Sep 21 04:16:15 2013 [pid 1] [ftpuser] OK LOGIN: Client "w.x.y.z"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "230 Login successful."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "PASV"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "227 Entering Passive Mode (w,x,y,z,204,159)."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "TYPE A"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "200 Switching to ASCII mode."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "NLST /var/www/wp-content"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "150 Here comes the directory listing."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "226 Transfer done (but failed to open directory)."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "PWD"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "257 "https://wordpress.stackexchange.com/""
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "PASV"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "227 Entering Passive Mode (w,x,y,z,102,89)."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "NLST /"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "150 Here comes the directory listing."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "226 Directory send OK."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "CWD /"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "250 Directory successfully changed."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "PWD"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "257 "https://wordpress.stackexchange.com/""
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "CWD /"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "250 Directory successfully changed."
...(above 10 lines repeated 4 times)
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "QUIT"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "221 Goodbye."
2 Answers
Okay, this may sound crazy, but have you tried absolute directory refs, i.e.
/var/www/public_html/
for FTP_BASE
?
It does say in the codex:
FTP_BASE is the full path to the “base”(ABSPATH) folder of the WordPress installation.