Question

WordPress & plugins can't write files or create directories.

  • Posted on November 20, 2014
  • BanzaiAsked by Banzai

I have a Ubuntu droplet with LAMP installed at setup and I need to host a few different sites & domains there, so the first site’s path is /var/www/sitename.com/public_html, as opposed to the single-install WordPress setup. I also set up phpMyAdmin according to the DO tutorial, then set up the WordPress user and db, and imported the data. Then I copied the WordPress site up and unzipped it in place. At this point the admin and front end work except when needing to write a file or create a directory.

I then followed this tutorial – https://www.digitalocean.com/community/tutorials/how-to-configure-secure-updates-and-installations-in-wordpress-on-ubuntu – to the letter and didn’t hit any snags. It’s still unable to write to files or create directories, though. The admin looks fine but my front-end is completely unstyled because it’s dependent on a LESS plugin that needs to write newly compiled CSS files.

I’m a little lost at this point because I don’t know what else to do beyond setting ownership to wp-user:wp-user and making sure the permissions are set to the correct levels according to the Digital Ocean tutorial. Any ideas?

Thanks!

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Have you added the following lines to wp-config.php?

define('FTP_PUBKEY','/home/wp-user/wp_rsa.pub');
define('FTP_PRIKEY','/home/wp-user/wp_rsa');
define('FTP_USER','wp-user');
define('FTP_PASS','');
define('FTP_HOST','127.0.0.1:22');

Make sure that the paths are correct. The files should look something like this:

-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
ssh-rsa ... kamal@iodine

If they’re correct but it’s still not working, try SSHing in manually:

ssh -i /home/wp-user/wp_rsa wp-user@localhost

Does that work?

Why not stick with the default permissions?

chown www-data:www-data /var/www/sitename.com/public_html

This comment has been deleted