Wordpress on Ubuntu install plugins without FTP access
Asked Answered
E

6

17

I run my own web server for development and, on it, I installed a WordPress instance. When I try to add plugins to this instance from the admin interface, WordPress asks for FTP access.

I don't use FTP and have no plans to do so in the future. I know I can change some configuration in WordPress so that I am able to upload without FTP. What exactly should I configure to accomplish this?

Explicative answered 16/8, 2010 at 11:44 Comment(1)
Did I not answer your question?Broek
B
13

One of three things:

  1. Either change permissions so your web server can read the wp-content directory, which should be fine for a development server.
  2. Run PHP as FastCGI which can run as a different user than your web server.
  3. Install the ssh extension for PHP (sudo apt-get install libssh2-php on ubuntu on think)
Broek answered 16/8, 2010 at 17:32 Comment(4)
+1 - Just dealt with this issue myself. I used solution #1 and chown'd the directory containing wordpress to user www-data.Inscribe
@Ryan for you own sake and sanity, it might be better to use setfacl to give you and www-data access to it, just so you can access the files as well.Broek
You just blew my mind. I never knew setfacl existed, but it will undoubtedly make my life easier. Thanks!Inscribe
Curiously, changing group ownership to www-data with rw perms still resulted in the ftp page being invoked. Only when changing the actually owner to www-data did it go away. Any ideas why?Motherly
S
14

Execute this command on your ubuntu terminal

sudo chown -R www-data /var/www
Shocker answered 28/5, 2014 at 19:41 Comment(2)
Shouldn't just the group www-data be enough?Agnew
I think, assigning the group as www-data would be enough, no need for www-data as the userWennerholn
B
13

One of three things:

  1. Either change permissions so your web server can read the wp-content directory, which should be fine for a development server.
  2. Run PHP as FastCGI which can run as a different user than your web server.
  3. Install the ssh extension for PHP (sudo apt-get install libssh2-php on ubuntu on think)
Broek answered 16/8, 2010 at 17:32 Comment(4)
+1 - Just dealt with this issue myself. I used solution #1 and chown'd the directory containing wordpress to user www-data.Inscribe
@Ryan for you own sake and sanity, it might be better to use setfacl to give you and www-data access to it, just so you can access the files as well.Broek
You just blew my mind. I never knew setfacl existed, but it will undoubtedly make my life easier. Thanks!Inscribe
Curiously, changing group ownership to www-data with rw perms still resulted in the ftp page being invoked. Only when changing the actually owner to www-data did it go away. Any ideas why?Motherly
D
1

DON FLANNAGAN’s method works for me , THX

Blockquote

One way to do it is change assign ownership of the wordpress installation to www-data:

chown -R www-data:www-data . Change file permissions:

chmod -R g+rwX . Add yourself to the www-data group:

usermod -a -G www-data myusername

Blockquote

Diarchy answered 2/9, 2023 at 2:25 Comment(0)
M
0

I was not satisfied with any of these answers so I kept on searching. I found an answer that was so simple I was surprised it had not been mentioned already.

https://askubuntu.com/a/826805/145472

This answer says to add a line to wp-config.php

define('FS_METHOD', 'direct');

Job done. I cannot take credit for knowing this but I do feel it needs a mention here too.

Muns answered 5/9, 2018 at 21:58 Comment(1)
Yes, it's correct but see this: https://mcmap.net/q/63866/-can-i-install-update-wordpress-plugins-without-providing-ftp-accessBiomass
D
0

One way to do it is change assign ownership of the wordpress installation to www-data:

chown -R www-data:www-data .

Change file permissions:

chmod -R g+rwX .

Add yourself to the www-data group:

usermod -a -G www-data myusername
Del answered 20/8, 2022 at 1:16 Comment(0)
D
-1

The funny thing is that uploading media works. So I was wondering why plugins not? After changing the ownership of wp-admin it worked for me.

sudo chown -R www-data wp-admin
Diluent answered 6/4, 2017 at 8:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.