I installed wordpress on lamp and cannot update themes or install plugins.
I get an “unable to create directory” error when I try to. When I spoke with support they told me to do this:
root@domain:~# chown -R www-data /var/www/wordpress
but what I got was this:
chown: cannot access `/var/www/wordpress’: No such file or directory
What’s the fix? Add the directories and files to www-data and your linux standard user account to the www-data group. (www-data is the user account Apacheis running as – Find through Top)
Everyone experiencing this issue should execute these commands:
sudo usermod -aG www-data $USER
Adds the currently logged in user to the www-data group.
sudo chown -R www-data:www-data /var/www
Changes the ownership of the /var/www directory to www-data group.
sudo chmod -R 774 /var/www
Sets the proper permissions so you can upload files via sftp, manage files via command-line, and upload plugins and media directly in WordPress.
Inspired from the following article at Digital Ocean.
Additional Note:
755 for all folders and sub-folders.
644 for all files.