-
- 293 Posts
If using apache can you go into your domain.com dir and type:
chown -R www-data:www-data public_html
(sorry typed from my phone)
-
- 184 Posts
Thanks.
I think I messed up my directory structure.
I use /home/domain.com/public_html/files.
I think MODX likes /home/domain.com/www/files.
So, I'm trying to apply your command, but haven't figures out what the www-data is for yet.
I tried # sudo chmod -R 755 public_html.
[ed. note: eiger3970 last edited this post 8 years, 9 months ago.]
-
- 293 Posts
As long as the directory is web accessible it shouldn't really matter what the name is. www-data is the apache web server user and that command makes it the owner of everything inside the public_html dir. Therefore theoretically not choking on permission issues.
Basically your problem was that the core directory was owned by "root" and only had read-execute permissions for anybody else (in the case of a directory "execute" permission means that somebody can open the directory to look at what's in it).
Exactly what permissions and ownership is needed depends entirely on how your server is configured.
It appears that your web server is configured to use the "public_html" directory as its web root. Most hosting will also have a "www" directory, one is just an alias for the other. It doesn't really matter which one you use, although using the actual directory name may be a little faster.
The owner of the MODX files should be your user (not "root") which you have showing in your sample as "domaindotcom".
The tricky part is to determine if your web server is configured to switch to the file owner's user to run a PHP file (like the MODX index.php file). If it is, then when MODX tries to write to the cache it's doing it as your user, so everything will be fine with the permissions you show in your sample, (755 and 644) as long as the owner of everything is your user. Since the "root" user can do everything and anything on the whole server, it's never acceptable to let the web server switch to run .php files as the "root" user.
If the server is not configured to change to the user that owns the .php file, then it will run as the web server user (this can be "apache", "www", "nobody", or whatever the server administrators set it to be), because the web server is the one running the .php file, then any files and folders that need to be written to must have global write permissions, so the cache folder and all of its files would have to have drwrwx-rwx (777) for folders and rw-rw-rw- (666) for files. This would apply to the core/components/, core/packages/ and the entire assets/ directories as well.
Setting all the files to be owned by the web server is also a simple option, it all depends on who is administering your server and how much control over it you have. That would be a very bad idea in the case of shared hosting, where hundreds, if not thousands, of total strangers are sharing the server with you, all using the same web server. If it's your own server, or a VPS, then it wouldn't be a problem.
-
- 293 Posts
Ah yes, very good point about www-data and shared servers!