Fix file permissions

SYSTEM INFORMATION
OS type and version Ubuntu 20.04
Virtualmin version 7.7

Not sure if this a bug or a error, but every time I upload php files for a site I come across error 500. I have to fix file permissions every time I upload. Has anyone came across this?

Thanks!

I assume you mean using the File manager in Webmin tools?
I tested this on my Centos server and my Ubuntu server and both worked fine. The file uploaded and had 0644 permissions.

That probably means you’re uploading files as root, which would be expected to require permissions to be fixed.

If you upload via ssh or ftp as the domain owner, the permissions should be correct (unless you’re using mod_php, which you should not do). File Manager will also override the user and set ownership correctly for domain homes (so even if you’re root, it will assume that if you’re uploading files to a Virtualmin home, you want it to be for that domain).

1 Like

I tested using the virtualmin file manager, uploaded a zip folder, unpacked it. owner shows root:root till i fix the permissions

Tested the same procedure on one of my servers. Logged into Webmin as root and then uploaded a zip into 2 different accounts using the File manager under Webmin. Both showed the owner as the home owner. I then unzipped and the resulting files also showed the proper owners.

Just to be sure I did the same process using the File manager under Virtualmin. Same result.

I then tried uploading the file into the root directory and the ownership then displays root.

If I upload outside of the home directory it takes root as the owner. Inside a home directory it takes the home owner as the owner.

kim

How do you have this setting set?

1 Like

Where is this at?

If i use the domains ftp account via filezilla instead of using root login permissions are fine.

image
Module Preferences. Look under under Advanced in the preferences dialog

mine is set to: Automatically set owner and group equivalent to user home on file operations
Yes

Just grasping at straws
Have you tried changing that to No, saving and then testing and then switching it back?
and/or switch the theme and try without using Authentic Theme? I believe Authentic theme is the only one that allows access to that option, though I am not sure.

I tried it and no dice, believe the issue is im logged in as root, when i made the domains i didnt make a webmin login for the domains

If root user uploads a file or a directory inside user home, then the files automatically get that user permissions.

But where exactly do you upload the files … to which directory?

to the public_html

Can you provide more info? A screenshot, maybe? Do you do this under user home?

I can show a screenshot after work

I was assuming FTP or ssh, not File Manager. I mentioned that File Manager would fix permissions for root user.

1 Like

As an alternative, if you use this module rather than File Manager and change the ownership from root to whatever, does it work?


or does it always revert the ownership back to root?

Whoops, sorry I was in Webmin not Virtualmin

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.