Hi, today I got a case user uploaded files via SFTP , which caused permission and user group problem with PHP
so if files were uploaded by SFTP , or unzipped by SSH command , the files are owned by root:root , which PHP user will have permission issue.
so how do we fix it ?
-
prevent it happen , use file manager to upload and extract , you can use SFTP to upload ,and then use file manager to extract , that way won’t have permission issue.
-
if files are already in place , and you want to fix this issue.
run
ls -l /home/your-domain/public_html
to check if the issue is indeed caused by permission and owner.
in this example , files are owned by root , which is a problem.
now find out the right user for them
ls -l /home
as you can see in screenshots , in this example , the site own of “test.cyberpanel.net” is named “testcyb” and in group “testcyb”
so now we can run this command to change the owner
chown -R testcyb:testcyb /home/your-domain/public_html
and remember repeat first step to double check if the owner is successfully changed
How to fix permission from the CyberPanel File Manager?
Now CyberPanel also allows you to fix permission from the CyberPanel file manager with just one click.
To perform this you can log in to your CyberPanel at port 8090 like:
https://ip:8090
After accessing your CyberPanel dashboard go to Websites->list websites here you can list all the websites on your server.
Now in front of your websites, you can see the File Manager button click this to access file manager.
Here in the file manager, you can see the fix permission button.
When you click this fix permission button this will fix all the permission issue and make it to default.