Wordpress Plugin Update Failed Could not copy file error occurs - wordpress

I'm using amazon web server and while updating any plugin an "Update Failed: Could not copy file" error occurs.
I have set /opt/bitnami/apps/wordpress/htdocs and /opt/bitnami/apps/wordpress/htdocs/wp-content to 777, but still my plugins are not updating.

I found the solution
sudo chown -R bitnami:daemon /opt/bitnami/apps/wordpress/htdocs
sudo find /opt/bitnami/apps/wordpress/htdocs -type f -exec chmod 664 {} \;
sudo chmod 640 /opt/bitnami/apps/wordpress/htdocs/wp-config.php
sudo find /opt/bitnami/apps/wordpress/htdocs -type d -exec chmod 775 {} \;
After that, please restart services and try to update plugins again
sudo /opt/bitnami/ctlscript.sh restart

Related

Amazon AWS EC2 Openlitespeed Permissions for SFTP

I setup SFTP on the EC2 Instance with Openlitespeed via Filezilla and it connects but I could not upload, delete or move files.
I then tried the solution suggested on this post:
Amazon AWS Filezilla transfer permission denied
So for UBUNTU,
sudo chown -R ubuntu:ubuntu /var/www/html
sudo chmod -R 755 /var/www/html
This solved that problem but now wordpress is asking for FTP details to install a plugin and the config.php and .htaccess is no longer writable (enabling/disabling litespeed cache plugin).
So this has reset the permission for wordpress as well. Does anyone have the solution how to fix the wordpress permissions on the server?
Thank you in advance.
you need to match the user that runs OLS/LSPHP
run grep -i "user" /usr/local/lsws/conf/httpd_config.conf to get the user that runs OLS , which I assume it should be www-data
then you need to chown -R www-data:www-data /var/www/html
after that, do :
find /var/www/html -type d -exec chmod 0755 {} \;
find /var/www/html -type f -exec chmod 0644 {} \;
to restore the file perm to 644, and dir perm to 755, as its previous status that ditrubted by your chmod -R 755 command.

How to reset Read write permission in AWS lightsail for wordpress

Have a look at this image : http://prntscr.com/iadnrl
Adding new theme to Wordpress after deleting all tables and data. While activating new theme getting this mentioned error of connection FTP.
I already tried following commands , seems does not worked.
sudo chown -R bitnami:daemon /opt/bitnami/apps/wordpress/htdocs
sudo passwd bitnamiftp
Hosting is on AWS Lightsail.
Please share your views.
TAKE A BACKUP BEFORE RUNNING THESE COMMANDS. I am not responsible for any error.
The following command worked for me. Make sure to replace the bitnami to the proper user.
Change to proper permissions of all files:
find /opt/bitnami/apps/wordpress/htdocs -type f -exec chmod 0644 {} \;
find /opt/bitnami/apps/wordpress/htdocs -type f -exec chown bitnami: {} \;
Change to proper permissions of all folders:
find /opt/bitnami/apps/wordpress/htdocs -type d -exec chmod 0755 {} \;
find /opt/bitnami/apps/wordpress/htdocs -type d -exec chown bitnami: {} \;

AWS EC2 Ubuntu File permissions issue

I'm running a EC2 instance with:
Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-119-generic x86_64)
Bitnami LAMP 5.6.30-5
My problem
I have a Wordpress site that isn't working very well on the backend, so I decided to update and I get an error "Can not create the directory..." when updating. So I did a research and it's related to file permissions. So I get to this conclusion:
I having the following issues with the file permissions:
Can't write files from server
I used is_writable() (PHP) to detect if server can edit and it returns false.
Can edit files from Filezilla
I login to the server with the "bitnami" user and everything works good.
I tried
sudo chown -R bitnami:www-data htdocs/
I added the default user "bitnami" to the www-data group and changed the /htdocs owner.
And, yes the user is in the www-data group.
find htdocs/ -type d -exec sudo chmod 2775 {} +
Changed directory permissions
find /var/www -type f -exec sudo chmod 0664 {} +
Changed the files permissions
How to solve this?
I tried all that and also giving the owner to root:root, www-data:www-data and bitnami:bitnami.
If someone knows the original user and group owner of the /htdocs folder I could try a test, but I forgot.
I would appreciate if anyone can help me to solve this. I just want to be able to write/edit files from server side.
Many thanks.
I solved this by doing the following:
Set htdocs owner to bitnami:bitnami
sudo chown -R bitnami:bitnami htdocs/
Inside /htdocs, changed file and directories owner to bitnami:daemon
sudo chown -R bitnami:daemon
Changed files and directories permissions
sudo find * -type d -print0 | xargs -0 chmod 0755 # for directories
sudo find . -type f -print0 | xargs -0 chmod 0644 # for files
Changed wp-content directories permissions to 775
sudo find wp-content/ -type d -exec chmod 0775 {} \;
And with that now I'm able to edit and upload via FTP and in the WP admin dashboard.

Connection information required to install a theme in wordpress

I have installed WordPress on Linux with Nginx, But when I am trying to install the theme it asks me for FTP connection confirmation every time.
I have found solution to my question first we need to change the ownership permission to access directories
chown -R www-data:www-data your-wordpress-directory
Now we remove secure permission to confirmation of connection to make it direct installations from wp-config.php
define('FS_METHOD','direct');
Now we need to ensure the permission of the folder set or not
sudo find /var/www/wordpress/ -type d -exec chmod 755 {} \;
sudo find /var/www/wordpress/ -type f -exec chmod 644 {} \;

CSS is not working after installation in Magento 2

I have Installed Magento 2.
Everything completed successfully but the CSS is not loading.
I tried these commands
php bin/magento cache:flush
php bin/magento indexer:reindex
php bin/magento setup:static-content:deploy
Please, before doing anything go to magento2 basedir and do:
nano vendor/magento/framework/Filesystem/DriverInterface.php
and change
const WRITEABLE_DIRECTORY_MODE = 0770;
from 0770 to 0775
and
const WRITEABLE_FILE_MODE = 0660;
from 0660 to 0644
The above set 0775 for folders and 0644 for files on generated/cached entities
Then change whole magento2 filesystem to the same permissions
find . -type d -exec chmod 775 {} \; && find . -type f -exec chmod 644 {} \; && chmod u+x bin/magento
Important,
you should execute bin/magento as a common user, and not as root. So if you are in bin/ folder you may use for example:
sudo -u youasuser php -d memory_limit=512M magento setup:upgrade
You need memory_limit=512 as some callings like setup:di:compile needs more memory.
Please check mod_rewrite is enabled on your web server.
First create a magento_user: adduser <username> and give user a password passwd <username> (May have to use sudo, if not already root)
Find your web server group: ps aux | grep apache Typically www-data
Add new user to this group: usermod -g www-data <username>
groups <username> should show the groups that username belongs to.
Restart webserver, so permissions can take effect service apache2 restart
Set ownerships of files in Magento root. chown -R :<your web server group name> .
Finally set permissions find . -type d -exec chmod 770 {} \; && find . -type f -exec chmod 660 {} \; && chmod u+x bin/magento
Reference: Set file system ownership and permissions and Create the Magento file system owner
You should Provide Some permissions
run this command
sudo find . -type d -exec chmod -R 777 {} \;
&& sudo find . -type f -exec chmod -R 777 {} \;
&& sudo chmod u+x bin/magento

Resources