How to reset permissions on hosting account files
I have an account on my server with wordpress installed as an add-on domain. Somehow I must have screwed up the permissions on the account because WP will no longer allow me to install anything (says it cannot create folders, etc.). Is there any way to easily reset the permissions including ownership of folders and files on an account to the way they were when the account was opened?
I had considered deleting the account and restoring from backup but wouldn't that just put the same permissions back in place? This has been going on for a while so I do not have a backup from before the problem started.
Any idea how I can fix this?
-
Here is how I usually correct all permissions for a site (as root). (You may need to ask the server administrator to do this for you if your Reseller shell access doesn't have enough privileges) find /home//public_html/ -type f -exec chmod 644 {} \; find /home//public_html/* -type d -exec chmod 755 {} \;
Replace with the actual account username. If your Add-On domain is being served from another folder, or from outside of /public_html, you should modify the folder paths as necessary. You can also change the file and folder permissions from the File Manager in the users cPanel. See0 -
While the above is usually fine, some files and folders sometimes needs other permissions. 0 -
I gave those commands a try. Sadly I still get the Could not create directory error. Could it be ownership somehow? /Public_html is username:nobody but all files and folders inside the public_html have been set as username:username recursively. drwxr-xr-x 9 username username 4096 Sep 9 19:46 sitename.com and inside that folder as an example: -rw-r--r-- 1 username username 3340 May 22 23:39 wp-config.php drwxr-xr-x 7 username username 4096 Aug 9 2017 wp-content -rw-r--r-- 1 username username 3669 May 11 03:24 wp-cron.php -rw-r--r-- 1 username username 246 Jul 29 2014 wp-feed.php drwxr-xr-x 18 username username 12288 May 11 03:25 wp-includescd if I dig deeper into those folders the permissions and ownership seem to be correct. Is there anything else I should try? 0 -
Hi @maestroc What's the error you're getting specifically - this would most likely show up in the PHP logs (if enabled) from the domain's docroot Thanks! 0 -
Hi @maestroc What's the error you're getting specifically - this would most likely show up in the PHP logs (if enabled) from the domain's docroot Thanks!
The error_log file is there but it hasn't been updated since around the time this problem started happening. My guess is that the error_log for that folder cannot be written to even though it is set to 0644 and username:username If I force an error by trying to install a new plugin it does not append anything to the error file. The last lines in the file are from a year ago (yes this site does not get new content very often). Those lines are pasted below but I don't think they are applicable to this. No idea though... [01-Sep-2017 08:07:55 UTC] PHP Warning: Illegal string offset 'choice_new' in /home/xxxx/public_html/vx/wp-content/themes/wp_olympic5-v1.0.1/functions.php on line 308 [01-Sep-2017 08:07:55 UTC] PHP Warning: Illegal string offset 'placeholder' in /home/xxxx/public_html/vx/wp-content/themes/wp_olympic5-v1.0.1/functions.php on line 309 [01-Sep-2017 08:07:55 UTC] PHP Warning: Illegal string offset 'section_id' in /home/xxxx/public_html/vx/wp-content/themes/wp_olympic5-v1.0.1/functions.php on line 310 [01-Sep-2017 08:07:55 UTC] PHP Warning: Illegal string offset 'option_group' in /home/xxxx/public_html/vx/wp-content/themes/wp_olympic5-v1.0.1/functions.php on line 3130 -
I hate to do this: You may want to review Download a new copy of the wp_olympic5-v1.0.1 theme to your computer, and compare the functions.php file to the one on the server. (This is not 100% fool-proof, as the theme provider itself may have been compromised at source) If the site has been hacked, they may have set the files or folder to be immutable, and even installed more damaging remote access software or a webshell (not necessarily in that particular account or folder) If you determine that the theme is OK and non of the files have been tampered with, and that there are no other signs of rogue files or access, you could try switching to one of the standard Wordpress themes for a moment, and see if the problem persists. A couple of other forum posts that may be relevant: 0 -
Thank @maestroc for posting the errors you were receiving as you can see they helped a lot! I'm glad you were able to get the issue fixed. @rpvw thanks for the sound advice! 0
Please sign in to leave a comment.
Comments
8 comments