[Tutorial] How to fix permission and user/group problem on CyberPanel.

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 ?

  1. 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.

  2. 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.

2 Likes

Another tip: Use su testcyb before unzipping or performing actions using SSH. It’ll log you to user’s ssh account and file permissions will also be under him!

@jetchirag said:
Another tip: Use su testcyb before unzipping or performing actions using SSH. It’ll log you to user’s ssh account and file permissions will also be under him!

lol , thansk , Linux experts XD

1 Like

Will this be fixed in the next updates? I think this is a huge issue

@ricardofh said:
Will this be fixed in the next updates? I think this is a huge issue

This issue is addressed, there will be a one-click fix permission in Filemanager, a package will be available to upgrade/download soon.

Thanks @usmannasir! Will there be a litespeed optimization or something? for being litespeed site load a bit slow (compared to litespeed for cpanel for example)

Are you referring to control panel side or normal websites on the server?

null
Normal websites

Your filemanager issue is fixed: http://docs.cyberpanel.net/doku.php?id=change-log

@usmannasir

I recently installed cyberpanel on GCP as FTP is not working properly I used SFTP access by adding SSH key to cyberpanel & enabling root login.

But now I am unable to update WordPress plugins as their is some file permission issues, I am getting below message when I try to update plugins:

Update Failed: The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.

I have tried to change file permission from file-manager but it’s not working & any Idea how to resolve the issue.

I managed to fix the issue using the tutorial method when I switched to root user, before was getting stuck at [ ls -l /home ] command. GCP doesn’t offer direct login as root.

Thanks.

I try install Mautic in cyberpanel, my VPS is GCP, but error see https://prnt.sc/scc2kf … how to fix it? thank

did not work in my case

If you tried this and got operation not permitted.

“chown -R testcyb:testcyb /home/your-domain/public_html”

[note: testcyb is from the example above would be the user owner of that site]

Then try this:

“chattr -V -i -R /home/your-domain/public_html”
[To remove the invisible locks]

followed by

“chown -R testcyb:testcyb /home/your-domain/public_html”
[To give back permissions to your folder]

Then go to fix permissions in cyberpanel file manger and refresh/restart litespeed.

Might not be everyone’s situation, but worked for me.
Hope this saves you a cup of coffee.

1 Like

@frankpanduh → chattr -V -i -R /home/your-domain/public_html it worked like a charm for me… @qtwrk PLease add this line in case anyone faces any errors while chowning… “chattr -V -i -R /home/your-domain/public_html”