-
☆ A M B ☆
- 2,475 Posts
This seems like it would be completely simple, and yet I’m running into problems creating new sub-folders in the assets folder. I know this is a server issue because I *CAN* add folders via the MODx manager on one install where the host is "standard" hosting company, but when it’s using MODx on my Linux server, I get the permissions errors.
So, it’s gotta be something on the server... permissions? File owner? Umask?
My assets directory has these permissions:
755 (same as the working server)
The folder is owned by root, group is root (vs. a limited user on the hosted site). php umask(); returns ’18’ on both servers (although on my linux box, the shell function "umask" returns 22... don’t know if that’s a hex/binary type display difference between php umask and the shell umask functions).
I don’t want to have to add directories via the root user. What needs to be changed on the server so that MODx can add new sub-directories?
-
☆ A M B ☆
- 2,475 Posts
The interim solution is to change the permissions:
chmod -R 777 assets/
But why does it work with 755 on the other host? That’s really driving me crazy trying to figure that one out. Ideas?
-
☆ A M B ☆
- 24,524 Posts
The host where 755 works is running php with some kind of suexec. Your current host does not.
Ordinarily PHP is an Apache module. This means that normally a php script runs as the Apache user. Your folders and files that you upload with your FTP client are owned by you. The permissions have to be set to allow "other" users to access these files and folders. For the most part, they only need to be able to open and read folders, but if you want your scripts, such as the MODx file manager, or MaxiGallery, to be able to create folders or upload files, you have to allow "others" to write as well. Of course, this is not particularly secure, since it is now possible for anybody that manages to break into the server to also access these files and folders. It also has the disadvantage that now any files your scripts upload or create can’t be deleted or modified by your FTP user, since they are owned by the Apache user because that’s the user the script runs as.
When suexec is used (there are several ways of doing it) when a script runs, its user is changed (Switch User exec) to the owner of the script, in this case that’s you. So you really don’t even need to allow group or other any permissions at all, since you are the owner of the files and folders, and the scripts run as you all you need are owner permissions.