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 {} \;
Related
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.
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: {} \;
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.
When i try to update any plugin it will show blank page on the right. No errors displayed.
Uninstall is working perfectly.
Cannot install new plugin & cannot update WordPress Core
NO ERRORS DISPLAYED, only white page on right (you can see side menu of dashboard)
Hosting my Files in VPS - Centos 6 - Apache 2.4.6
Recently i updated PHP 5.3.26 to PHP 5.4.17
I tried Changing Owner Permission to Apache. (i was unable to login - then changes back to my username)
I tried chmod 777 no use.
I tried adding in wp-config.php - define('FS_METHOD', 'direct'); & chmod 777 to wp-content directory.
Please help.
NEVER use 777 permission! Wordpress only need 755 for folders, 644 for files, and 666 for themes and plugins directory recursively. And you might want to give 600 to wp-config.php.
I had this problem, I use CentOS 7 though, this is how I solved the issues.
Make sure all owned by Apache.
sudo chown -R apache:apache /var/www/html/sitedir
Give proper permissions
sudo find /var/www/html/sitedir -type d -exec chmod 755 {} +
that would give 755 permission to all folder inside sitedir
sudo find /var/www/html/sitedir -type f -exec chmod 644 {} +
that would give 644 to all files
sudo find /var/www/html/sitedir/wp-content/themes -type f -exec chmod 666 {} +
sudo find /var/www/html/sitedir/wp-content/plugins -type f -exec chmod 666 {} +
those two commands above make 666 permission to all files inside themes and plugins folder
If you use selinux
set this first
sudo chcon -R system_u:object_r:httpd_sys_content_t:s0 /var/www/html/sitedir
then this
sudo chcon -R system_u:object_r:httpd_sys_rw_content_t:s0 /var/www/html/sitedir/wp-content
Restart php-fpm service if you had one.
UPDATE:
If you don't get through until this point. You might also need to set a local policy module for selinux.
sudo grep php-fpm /var/log/audit/audit.log | audit2allow -M mypol
sudo semodule -i mypol.pp
Then restart php-fpm.
As I cover here more detail on my blog :)
I've already read http://codex.wordpress.org/Hardening_WordPress but I can't get my head around it. What are the permissions that shall be set and by who shall it be owned by? Right now I have set as the result of the following commands:
# reset to safe defaults
find /usr/share/wordpress -exec chown www-data:www-data {} \;
find /usr/share/wordpress -type d -exec chmod 755 {} \;
find /usr/share/wordpress -type f -exec chmod 644 {} \;
# allow wordpress to manage wp-config.php (but prevent world access)
chgrp www-data /usr/share/wordpress/wp-config.php
chmod 660 /usr/share/wordpress/wp-config.php
# allow wordpress to manage .htaccess
chgrp www-data /usr/share/wordpress/.htaccess
chmod 664 /usr/share/wordpress/.htaccess
# allow wordpress to manage wp-content
find /usr/share/wordpress/wp-content -exec chgrp www-data {} \;
find /usr/share/wordpress/wp-content -type d -exec chmod 775 {} \;
find /usr/share/wordpress/wp-content -type f -exec chmod 664 {} \;
After this configuration the installation is unusable. Any tips?
Here's a quick recap of how I manage permissions on my servers:
Anybody can read files and directories
Nobody can write anything outside of the /wp-content/uploads directory
PHP scripts can not be executed inside the /wp-content/uploads directory
PHP scripts can not be executed directly in /wp-includes and /wp-content
So it doesn't matter who owns the .php files, as long as the apache user can read them. Allowing the apache user to modify these files is a risk, even .htaccess. The downside of all of this is that you'll need to provide WordPress with FTP credentials to do things like install or delete a plugin, update a theme or core, etc. That's something I can live with.