0

I've ran into this issue where WordPress requests my FTP login credentials.

So far I've tried:

  • chown
  • change user
  • change file permissions
  • edited wp-config.php

None of it seems to work. The server I'm hosting it on is a VPS. I don't have much info from it. I am able to connect to my FTP using FileZilla but WordPress doesn't seem to be able to connect to it. Is there additional info I should request from my web host to properly set this up?

EDIT:

I haven't looked into httpd.conf yet. The owner of the public_html directory is root. I changed the permissions and owner to root. Is that the wrong practice?

I spoke to my server guy this morning, the server is listening to port 22 but on the hardware firewall, the public IP is nat from port 2232 to the server's port 22. But the server doesn't allow wordpress webui to enter 2232 (the port i'm using for SSH).

This is the additional bit I added to wp-config.php:

define( 'FTP_USER', 'root' );
define( 'FTP_PASS', 'ftp-password' );
define( 'FTP_HOST', '123.123.123.123:2232' );
  • Are you facing the problem when you try to install new themes and plugins? If yes then contacting your hosting provider and ask them to solve this issue – bagpipper Jun 28 '16 at 10:37
  • 1
    Have you tried changing the user and group, then setting the permissions? This sounds more like a server level problem than a WordPress problem. Can you verify that PHP can write to those folders when loaded via the browser? Write a test file that when ran creates a helloworld.txt and puts "lorem ipsum" inside. If it works it's a WordPress problem. If it doesn't then it's a server/hosting problem and this isn't the appropriate place to ask – Tom J Nowell Jun 28 '16 at 10:44
  • Can you post what have you edited in wp-config.php and others ? – bravokeyl Jun 28 '16 at 10:45
  • 1
    Potential workaround - setting FS_METHOD to 'direct' in your wp-config. Note: not a full workaround, don't leave it there forever. See the docs here – Tim Malone Jun 28 '16 at 10:46
  • When you say that you've Chowned and CHMOD'ed the files. What did you do exactly. To whom and to what did you change the ownership and permissions to? – Howard E Jun 28 '16 at 14:05
0

Guess it needs to be said first - it is a bad idea in general to just let anyone that succeeded to trick you into uploading his PHP onto your server to actually be able to write to your code directories. It is double problematic if you let him access to your root credentials and write to anywhere on your server.

That said, it sounds like you just don't have an FTP server installed on your server. SFTP is different from FTP and being able to access via one do not ensure access with the other.

You should login to your server, run an FTP command with the credentials you put in the wp-config to first make sure you can connect and access the relevant directories. Once you can properly connect woth the FTP command on your server you can use the same credentials in your config.

  • So the solution here is to install a "ftp service" in my VPS, provide wordpress a different username/password for the ftp and allow it to read/write to the server? – fupuchu Jun 29 '16 at 9:28
  • As said in the prefix, I don't like the idea at all as IMO the security risk doesn't worth the time you save. If you do want it, then FTP is probably the wrong way to go about it and you should check that the file permissions to the WP directories are such that enable the web server user to write to them. If you do go with the FTP option, at least configure it to respect only requests coming from the local host, configure a special user for that and restrict its access to whatever is below the WP root directory – Mark Kaplun Jun 29 '16 at 10:27
-2

1) The first thing you have to do is to open the wp-config.php file from your WORDPRESS root folder.(wordpress/wp-config.php).

2) Paste the below code to your wp-config.php just below every other line of code.

define('FS_METHOD','direct');
  • 2
    How does this differ from the other answer by baconi. Also, as I have already commented on the answer by @baconi, why would this solve the issue – Pieter Goosen Jun 29 '16 at 7:37

protected by Community Aug 1 '17 at 18:42

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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