why i can't install a new plugin on my wordpress?

December 30, 2014 86.9k views

I can connect my vps ip with putty ,hostname is a.b.c.d , ftp user is root ,password is password .
None of connection type (ftp or ftps) can add a new plugin .

Failed to connect to FTP Server

Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.


18 Answers

Wordpress will prompt you for FTP credentials if it does not have permission to write the files it needs to. If you log in via putty and run the following command (assuming this is an Ubuntu droplet) it will set the files to be owned by the user that the web service is run as and should resolve the problem.

chown -Rf www-data.www-data /var/www/html/
  • OH MY GOD I have spent half a day looking for this solution. THANK YOU.

  • Thanks for the solution!

  • Dude, seriously, thank you!!!

  • I just want to add that sometimes sudo is required before the above command depending on the user you login in with

    • Absolutely. This assumes that you have not already created a non-root user and are using the default.

  • WORKED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    2016 #Stillsavingpeople'ssanity
  • Thank you ryanpq .. it really solved the problem

  • Woops it worked ! Thank you, it was really trouble for me

  • It's work perfectly.
    Thank you!

  • Wow ! It's worked. thank you so much !!

  • Thanks. It works for wordpress.

  • it works, many thanks~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  • That worked and Thank you.

  • Mantap, tengkyu geng, for the solution!

  • Thanks for the help, Get resolved

  • Good work., thank you

    I ran this command and it did let me install the plugins normally but now gulp is getting permission error while executing!
    'EPERM: operation not permitted, chmod '/var/www/html/wordpress'
    Need a solve for this, thanks!

    • Hi. The error you're seeing is related to permissions rather than ownership so you're half-way there with ownership now set correctly.

      This page in the WordPress Codex covers the correct default permissions to use on the files and directories in your WordPress installation. You can change them by using chmod commands.

      chmod XXX myfile

      Change one file or directory's permissions with a new numeric indicator.

      chmod -Rf XXX mydirectory/*

      Recursively change the permissions of everything in a directory where XXX is the numeric permission level.

      • Thank you for the reply! Can you be a little bit more specific on the command? I want to be able to install plugins and run nodejs packages inside the wordpress folder. So, should it be chmod -Rf 0666 /var/www/html/wordpress/* ? I'm new at using linux so don't wanna mess up my file permissions of the file structure. Thanks in advance!

  • Just want to add a small change as below command worked for me
    sudo chown -Rf www-data.www-data /var/www/html/

  • thanks a ton. it worked!

The command solved my problem.
What does www-data.www-data mean?
www-data is the group name ,how about the second www-data ?

root@rebuild:~# cat /etc/group

  • This is the user and group. In this case they share the same name. The syntax works like:

    chown -Rf user.group /path/to/files

    Where -Rf tells chown to implement this change (R) recursively and to (f) force the change rather than prompt for each file.

    The user.group can also be indicated with a colon separating them as user:group (some systems may not accept the . instead of the : )

On Centos running Apache to serve you can do like above but for the apache user

sudo chown -R apache:apache /var/www/html

hope this helps someone

Hey friend,
You can check out https://wordpress.org/support/topic/cant-update-plugins-or-wordpress-or-install-new-plugins for the solution.

At current date, there is no lack of WordPress plugins but the main problems arise during their installation. Especially while doing it via FTP method. Well it’s not like unsolvable issue; you can just follow the link I have suggested in order to tackle it down.

Thanks man, u wouldnt be able to guess the time i spent dealing with this, not to mention ruining my website in the process.
thanks thanks thanks X10000000000

It's awsome! I was trying to do this for two days! hahaha

Awesome!! Thank you for sharing the wonderful comment. I was able to resolve that issue as well.

Use sudo. It works for me. (Windows)
sudo chown -R www-data:www-data /var/www/html/

If you use the Centos system and use the NGINX as webserver, please type in terminal is:

sudo chown -R nginx:nginx /var/www/

This command will allow nginx execute read/write to folder /var/www/

I don't quite understand... Where should I type it?
I get the FTP Username but don't know the Password. Can I change it somehow?

Hey forum... This seems to be the thread with the right answers so if there's help out there, HELP!

I've been trying to upload an image but I'm encountering the following error:

"Unable to create directory /wp-content/uploads/ Is its parent directory writable by the server?"

I've tried the solution listed above but my story isn't a resounding success, iike so many others. The error persists. I installed via xampp and wordpress and I'm running OS X. I believe I've read every article on fixing permissions but none of the solutions have worked for me, or I have some kind of coding deficiency.

Any help would be greatly appreciated.

The error is on wordpress side, giving useless information

Mmmh, is wordpress made by microsoft?

use commad like this

root@server:~#chown -Rf www-data.www-data /var/www/html/

yes working fine

chown -Rf www-data.www-data /var/www/html/

Single command.

Have another answer? Share your knowledge.