Wordpress migration(local to Linode) is having permission issues
So I've got a LAMP stack running on CentOS on a Linode, and I've followed the guides to secure my server, set up remote access via key-pair, disabled SSH root access, enabled SFTP, have set up an SSL certificate and installed phpMyAdmin.
However, I'm still having a few issues. One major issue is that file permissions(specifically for /var/www/html) for SFTP access for my non-root user keep getting reset. I don't know if it happens when I restart Apache after making some change or the other, but every time I grant permissions via SSH, Filezilla will be fine writing and deleting inside the directory, but then some time later I get permission denied errors.
Additionally, my Wordpress install has a number of issues which I'm assuming are all permissions-related.
- If I try to browse plugins while my site is live I get an error asking for my SFTP credentials and "Please contact your server administrator.) in /var/www/html/wp-admin/includes/plugin-install.php on line 182". If I enter my credentials and SSH key passphrase, it reloads the page and redirects me to my themes page.
- If I try to browse themes, I get a similar error saying (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in /var/www/html/wp-includes/update.php on line 577
- My Media Library shows all my uploaded content when I access it via Media>Library, but I'm having issues with images that I uploaded. Images that were included in the theme I'm using as a base are still showing up, but images I replaced are not visible. When I try to replace any images in the page editor, the media library popup refuses to load anything. I also get this error " Updating failed. Error message: The response is not a valid JSON response. "
- Lastly, all my menu links(About, Gallery, etc) are broken and I'm not sure how to fix them.
I'd really appreciate any help.
1 Reply
Without having access to your Linode's internals, it's hard to say for sure what could be causing the permissions resets. However, I did some digging online, and came up with a few ideas for you. Keep in mind that all of this is just speculation on what might be able to help you out, so I hope that at the very least it points you in the right direction.
One page I found where a user was having a similar issue was directed to checking any cron jobs that might be running and resetting those permissions. That might be a good place to start:
Apache permissions keep resetting
Another thing you might want to try is having the permissions assigned at startup:
How to Start Application after Login to CentOS
If I try to browse plugins while my site is live I get an error asking for my SFTP credentials and "Please contact your server administrator.) in /var/www/html/wp-admin/includes/plugin-install.php on line 182". If I enter my credentials and SSH key passphrase, it reloads the page and redirects me to my themes page.
Again, I have to give a general answer here based on research I've done. I think the best way of tackling this is to check out this resource I found which gives a detailed account of using SFTP on WordPress, and making sure everything is set up properly:
How to Access WordPress Files Using SFTP
If I try to browse themes, I get a similar error saying (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in /var/www/html/wp-includes/update.php on line 577
For this error, I found a guide which is designed to help you troubleshoot this. I'll link it to you here:
How to Fix Secure Connection Error in WordPress
Updating failed. Error message: The response is not a valid JSON response.
This could also be a permissions issue. However, a page on the WordPress site regarding this error suggests using Health Check and disabling plugins in Troubleshooting mode. That way you can check to see which (if any) of the plugins are causing this.
The response is not a valid JSON response
Lastly, all my menu links(About, Gallery, etc) are broken and I'm not sure how to fix them.
A great resource I found on fixing broken links on a WordPress site:
How to Find and Fix Broken Links in WordPress (Step by Step)