Permissions problems - what could be wrong.

Akyhne

Verified User
Joined
Aug 27, 2009
Messages
20
I have a CentOs 5.2 VPS with DirectAdmin preinstalled.

From day one, I have had permission problems. Files created/edited via php are owned by apache:apache, files uploaded via ftp are owned by [user]:apache.
This has given me a lot of troubles. I mainly use the VPS for a SMF forum. If you know SMF, it has the ability to install mods etc.

So this has been a nightmare, until I found out to use suphp, phpsuexec or similar.
I spend the last few days trying to get suphp to work, but I always ended up with error 500 pages for all php files.
This nigthmare kept on, until I was told here to run
Code:
/usr/local/directadmin/scripts/set_permissions.sh all
Now it seemed to be ok. I could run php files, but if a php file called on a php file placed in a folder, I got a warning that there were permission problems. Folders were 644, so I made them 755.

Now everything seemed to work, but no. First of all if I create a file or folder with a php file, it can't be deleted again, although it's the same owner of the file. So basically I gained nothing by installing suphp, but the fact that all files now are owned by the same user - akyhne:akyhne.

The only thing I gained by installing suphp is that files created by scripts now can be edited/replaced/deleted by ftp and vica versa. But as mentioned, php just can't delete files created by php.

I'm tearing hair off. I've fighted these issues for more than a month, and I still don't have a running, usable VPS.

suphp also bother me the way that files and folders can not be 777 any more. SMF has the ability to make files and folders write protected. It first tries with 755, then chmod to 777 if they are not write protected. I ran that task yesterday, and my forum became unusable. Files and folder were made 777. Changing permissions back to 755 or even 644 doesn't help at all. So I guess I would have to run
Code:
/usr/local/directadmin/scripts/set_permissions.sh all
again to make the forum work. I just didn't bother trying as this is unusable to me.
suphp also bother me the way that php flags can't be used in .htaccess files. This makes it impossible for users to set specific settings.

Any ideas?
 
If php is still running as suphp,I suggest you run

Code:
cd /the/path/to/your/website/
find -typd d -exec chmod 755 {} \;
find -type f -exec chmod 644 {} \;

The folder is writeable with the 755 permission,if php running as suphp.

Or you can modify this file.

Code:
/usr/local/suphp/etc/suphp.conf

change there value

Code:
allow_file_group_writeable=false
allow_file_others_writeable=false
allow_directory_group_writeable=false
allow_directory_others_writeable=false

to

Code:
allow_file_group_writeable=true
allow_file_others_writeable=true
allow_directory_group_writeable=true
allow_directory_others_writeable=true

but it would be a bad idea,if group and others users have writeable permission,there is some security risk.

My English is poor,hope you can understand me.
 
Back
Top