4

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 "/""
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 "/""
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
  • Docs also say that FTP_CONTENT_DIR and FTP_PLUGIN_DIR are typically needed as well for symlink setups, have you tried those?
    – Rarst
    Commented Sep 21, 2013 at 14:06
  • Hi Rarst, unfortunately yes I have and I get the same thing.
    – simon
    Commented Sep 23, 2013 at 7:35

2 Answers 2

1

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.

1
  • Please comment when you need to comment. Don't answer instead. If you're missing rep to comment, then really answer questions to get your upvotes and rep. Thanks.
    – kaiser
    Commented Oct 3, 2013 at 2:12
0

Recreating the folderpath and symlinking with a back-to doc-root to a ../.. -chain makes the problem go away, an incredible fix for something that should not be broken. eg (docroot being at /path/to/docroot):

mkdir -p /path/to/docroot/path/to
ln -s ../.. /path/to/docroot/path/to/docroot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.