0

I know this is probably a file permission issue, but I can't figure out why it's happening. (I'm more trying to understand what's going on rather than looking for a quick fix.)

Why would I be able to upload media, but not update or install plugins? My wp-content folder and even plugins folders look to have the correct permissions. Apache server runs under www-data and that group has ownership of the folders and files.

drwxrwsr-x  6 www-data www-data  4096 Apr  2 21:40 wp-content
drwxrwsr-x 3 www-data www-data 4096 Apr  2 21:15 plugins

Note: I did read Why would WordPress request FTP information when it can write to the file server? but I'm still not completely understanding what's going on.

Note2: This is on a VPS not shared.

  • 2
    strange, not sure but in my experience a mismatch somewhere can be enough... sometimes resetting all the permissions recursively has fixed this for me, eg. chown -R www-data:www-data public_html ...worth a try? – majick Apr 3 '16 at 5:31
  • looks like that did the trick! If you want to add it as a solution I'll make it as the answer. – dangel Apr 5 '16 at 0:33
  • great it did it. i've added a more elaborate answer for future reference then, :-) – majick Apr 5 '16 at 6:02
0

Sometimes an owner/group mismatch in just one of the directories or subdirectories of your install can be enough to make WP_Filesystem see that the permissions don't match and ask for your FTP details instead.

eg. I have had this when copying/installing a plugin as root user via SSH, forgot about setting the owner/group, and then then plugin won't update directly later without fixing them.

You could try to track down those permissions and change them individually, but a good overall and fast solution to try is to simply update the owner/group permissions of your entire install recursively (from the level below public_html or your install root.) This has the added bonus of fixing any other permissions you may have forgot to fix too:

chown -R www-data:www-data public_html

Where www-data is your "web" user (will not be the same for everyone. eg. admin, apache)

Note this is a slightly shortcut method that is also the same as setting owner and group separately:

chown -R www-data public_html
chgrp -R www-data public_html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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