Correct user/group ownership and file permissions for Joomla and WordPress sites running on Ubuntu server

I am migrating some Joomla and WordPress sites from shared hosting to Digital Ocean. The servers will be running Ubuntu with a LAMP stack.

Each site will have the following permission requirements:

*  Allow the configuration.php (Joomla) to be updated using the administrator panel.
*  Allow all directories and files within /var/www/ to be editable by a custom user created by me. This will happen via SFTP for one single user.
*  Allow the Joomla and WordPress update systems (core and plugins) to work from the respective admin panels. This should happen without the FTP Layer enabled (Joomla) or the equivalent on WordPress.
*  Allow for image/media uploads (images for Joomla and wp-content/uploads for WordPress) to be allowed from the Joomla and WordPress admin panels.
*  When new files or directories are created, they should inherit the user/group ownership and permissions that were previously set. Files or directories will be created from within Joomla/WordPress or via SFTP.

I have been testing out various user/group ownership settings and file permissions from Ask Ubuntu post, but nothing has fully worked so far. Either making config updates via the admin panels work and SFTP does not or vice-versa.

Any suggestions or tips are greatly appreciated.

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.


By default, the Apache service runs as the www-data user on Ubuntu servers.

If you’ve used the root user to connect via SFTP, this would explain why the www-data user does not have privileges to read/write the files.

You could change the ownership of the files and folders using the chown command:

chown -R www-data:www-data /path/to/your/website/files

Make sure to change the /path/to/your/website/files with the actual path to your website files.

Hope that this helps! Regards, Bobby