Page 1 of 2

Since upgrading to 1.2 uploads are given 600 permissions

Posted: Tue Oct 30, 2007 11:33 pm
by cnymike
I have three installations of CMSMS that were upgraded to 1.2. All three are now giving permissions to uploads of 600.

umask is set to 022 and tests as read write, read, read

config.php has upload permissions set to 644.

When I ftp files in, they are given 644 permissions.

What could explain CMSMS all of a sudden giving permissions to uploads of 600? And more importantly how might I fix this?

Re: Since upgrading to 1.2 uploads are given 600 permissions

Posted: Wed Oct 31, 2007 1:22 pm
by klaus
I have the same problem!

But after a new installation and only with the new filemanager.
The uploads are given 600 permissions.

With the imagemanager everything works fine!


Any clue??
Thanks!!

Greetings
Klaus

Re: Since upgrading to 1.2 uploads are given 600 permissions

Posted: Mon Nov 05, 2007 8:51 pm
by JQ
I am having this issue as well. Can't seem to find a fix yet.

Re: Since upgrading to 1.2 uploads are given 600 permissions

Posted: Tue Nov 06, 2007 8:35 am
by cyberman
Warning - I'm not a coder for real ;), but you can try this:

Add

Code: Select all

		chmod($thispath, octdec('0'.$config['default_upload_permission']));
AFTER line 104 in action.upload.php

Re: Since upgrading to 1.2 uploads are given 600 permissions

Posted: Wed Nov 14, 2007 3:00 pm
by scotch33
have just tried this as mentioned here - it has not been successful - permissions are still 600 on uploaded files - so code after the add looks like as follows (from 102 to 112) - is this what we were supposed to do cyberman, or am I putting it in the wrong place?

Code: Select all

} else {
		if (trim($_FILES[$id."file_".$i]["name"])=="") continue;
		$thispath=$this->Slash($fullpath,$_FILES[$id."file_".$i]["name"]);
		chmod($thispath, octdec('0'.$config['default_upload_permission']));
		if (move_uploaded_file($_FILES[$id."file_".$i]["tmp_name"],$thispath)) {
			$messages.=$_FILES[$id."file_".$i]["name"]." ".$this->Lang("uploadsuccess")."<br/>";
		} else {
			$errors.=$_FILES[$id."file_".$i]["name"]." ".$this->Lang("uploadfail")."<br/>";
		}
	}
}
Thanks!

Re: Since upgrading to 1.2 uploads are given 600 permissions

Posted: Wed Nov 14, 2007 3:16 pm
by cnymike
I wonder if more people are experiencing this and don't realize that permissions have changed?

Dev team...is this a bug?

Re: Since upgrading to 1.2 uploads are given 600 permissions

Posted: Wed Nov 14, 2007 3:30 pm
by dmgd
cnymike wrote: I wonder if more people are experiencing this and don't realize that permissions have changed?

Dev team...is this a bug?
Yes I have the same problem.  Everything OK until upgrade to 1.2.  Also new install has the same problem. This is 1 of 3rd threads on the issue.

Re: Since upgrading to 1.2 uploads are given 600 permissions

Posted: Wed Nov 14, 2007 3:43 pm
by calguy1000
Okay, I briefly looked at this issue and there is a problem (but it's not as severe as you think).

a) File Manager isn't giving out the truth about permissions (checking the files with your ftp client
    will tell you the real story).  I'll fix this one soon

b) There seems to be some inconsistencies with permissions on uploaded files between the various modules, etc. 
    I'll check into this soon.

[correction]
You are correct, they are getting 600 permission.
i'm looking into it.

Re: Since upgrading to 1.2 uploads are given 600 permissions

Posted: Wed Nov 14, 2007 5:19 pm
by cnymike
Thank you for your attention to this matter.

May not be "severe" but it's put a screeching halt to user uploads being viewable by visitors to the sties since permissions must now be manually changed to 644 from 600

Re: Since upgrading to 1.2 uploads are given 600 permissions

Posted: Wed Nov 14, 2007 5:24 pm
by calguy1000
Okay, this issue is not unique to CMS Made simple, searching through google found hundreds of references to this issue.

The problem is the 'umask' of the parent process to apache (or one of those processes anyways) is 077 which causes files to be created as 600.  The move_uploaded_file php function preserves that permission.  We use that function everywhere.

Interestingly, the ImageManager does not use this function, it uses copy() which sets the file permission properly.

To solve this problem once and for all we will have to change ALL of the modules that allow uploading files (currently there are alot of them).

dammit dammit dammit!!!

Re: Since upgrading to 1.2 uploads are given 600 permissions

Posted: Wed Nov 14, 2007 9:13 pm
by cnymike
Is this sudden "thing" due to an Apace upgrade or what exactly is the culprit?

Re: Since upgrading to 1.2 uploads are given 600 permissions

Posted: Wed Nov 14, 2007 9:27 pm
by calguy1000
Well, it's sudden because the file manager has been replaced.

The old file manager used copy() I think..... which took the umask into cosideration.  Uploads module and FrontEndUsers do similar things. 

The Album module uses the move_uploaded_file function, as does CompanyDirectory, and (as of 2.6) News, and the New file manager.  so that would explain some of the difficulty with uploads people have been having with the album module.

I've written and committed a 'cms_move_uploaded_file' function which will call move_upload_files and then chmod the file to the permission specified in the config file.  I've converted the FileManager module, News, CompanyDirectory to use this new function now, and there'll be a CMS Made Simple 1.2.1 coming out soon.

Re: Since upgrading to 1.2 uploads are given 600 permissions

Posted: Wed Nov 14, 2007 10:38 pm
by cnymike
I've also reported as a "bug" the fact the FileManager has a confusing mix of upper and lower case usage as concerns the dropdown menu and the actual directory names. eg: "File" in dropdown menu versus "file" directory name and similarly with images, flash, media.
This caused me to have to move hundreds of files from "File" directory to "file" directory to keep up with the change that, at some point, the changed FileManager imposed upon CMSMS.

Re: Since upgrading to 1.2 uploads are given 600 permissions

Posted: Fri Nov 23, 2007 12:02 pm
by zebulon
Hi everyone,

kindly asking: is there anything new to this issue?

Re: Since upgrading to 1.2 uploads are given 600 permissions

Posted: Fri Nov 23, 2007 2:35 pm
by calguy1000
Interestingly, my research tells me that this is not a CMS issue.  it's common to many packages.  it's caused by certain web server configurations.  Anyways, in 1.2.1 we've made some changes to 'work around' this issue.

I'm just trying to get a bit more testing done before we release it.