Page 1 of 1

Safe Mode problem

Posted: Mon May 22, 2006 7:32 am
by enisdev
Hi,

I have a problem with cmsmadesimple.
for example when i create a folder trough cms i cannot upload a image to that directory.
The error message said that there is a safe mode restriction and de uid is not the same.
(i understand the reason of this it is logical but a solution ?)

I know there are another topics with the same problem but i didn't sea any solution.
The only solution is to set the safe mode off or create the folders with ftp etc.
The first one is not easy on a shared hosting. the second one is a workaround not a really solution.

How did you solve this problem ? who can help me ?

(sorry for my bad english :-) )

Re: Safe Mode problem

Posted: Tue May 23, 2006 11:54 am
by baconburgare
I think the workaround u mentioned is the only solution unless u can get rid of safe-mode. I have the same problem. A bit annoying but I guess we have to live with it. If you have customers working on your site, try to agree on, or suggest what folders they might need in the future. Add them and set correct properties. Also briefly explain the problem and make them aware it's a security issue you have to live with.

I'd be more than happy if someone could solve this but I don't think it's doable.

Re: Safe Mode problem

Posted: Wed May 24, 2006 2:33 pm
by enisdev
I will be happy to if someone have a solution for this.

If i have enough time i will try to build something generic to use virtual directory to fix this issue.
a virtual directory that uses filenames with prefix  and mysql usage....

another solution what i am thinking is to simulate a ftp connection in the background.

so create_folder('testfolder') will use ftp simulation to create that folder with the right ftp login..

Is this an idea ? suggestions are welcome..
if it works it is fine for every cmsmadesimpel user...

Re: Safe Mode problem

Posted: Thu May 25, 2006 12:54 am
by Ryno
I too have run into this problem as I'm also running CMS on a host with Safe Mode (grrrr).

Try this and let me know how you go:

  - Remove all directories created by CMS in the uploads folders
  - Jump up one level and assign permissions 2777 to the uploads folder (yes, that's 2777, not 777)
  - If you're FTP program does not support 4 digit permissions, then see if you can run a raw command. If you can, run this command

Code: Select all

SITE CHMOD 2777 /www/folder-to-assign-permissions-to
  - If your FTP does not support running raw commands, download FileZilla from source forge.

So why CHMOD 2777?

Your directories are by default owned by [your_primary_username]:users (the [your_primary_username] user in the 'users' group).

When a file is uploaded it is created by the Apache process and by default the ownership is set to www:www (meaning the 'www' user, in the 'www' group). To overcome this issue, chmoding your upload directory to 2777 means that any file created in that directory should inherit the group ownership of the parent directory.

Hope that helps...

Ryno

Re: Safe Mode problem

Posted: Thu May 25, 2006 9:56 am
by enisdev
I will try it today.
I have never heard about the 2777 setting :-)

I let you know if it helps.
thanks!

Re: Safe Mode problem

Posted: Thu May 25, 2006 1:30 pm
by enisdev
:(
I did what you suggested. but
When i upload a file to the folder that is created by CMS  i receive the well known error:
Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 10001 is not allowed to access /home/httpd/vhosts/mydomainname/subdomains/cms/httpdocs/3/uploads/test1 owned by uid 48 in /home/httpd/vhosts/mydomainname/subdomains/cms/httpdocs/3/admin/files.php on line 92

Re: Safe Mode problem

Posted: Thu May 25, 2006 10:50 pm
by Ryno
Mmmm...

I would now suggest talking to your web host as I'm not sure why that would not work. They might be able to set the permissions on the folder with their root access so the www user has access to write to the folder, as well as your user?

Sorry I could not be of more assistance, it should've just worked.

Ryno