Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: groyk on June 21, 2011, 10:29:04 PM

Title: php chmod in ibay
Post by: groyk on June 21, 2011, 10:29:04 PM
Hi guys

I am having troubles creating folders with right chmod settings.

I use: mkdir(folder, 0777, true);

But I end up both a folder that I can only create, edit, delete with pho.

Folder is created in ibays file directory tree. Please help.
Title: Re: php chmod in ibay
Post by: cactus on June 22, 2011, 07:35:36 AM
Isn't that what you are after? AFAICT the only thing you can do with a folder is to create, delete or modify it.
Title: Re: php chmod in ibay
Post by: groyk on June 22, 2011, 09:29:16 AM
I want to be able to create, modify, delete in samba share as well.
Title: Re: php chmod in ibay
Post by: cactus on June 22, 2011, 09:32:56 AM
I want to be able to create, modify, delete in samba share as well.
You should be able to do so, but that depends on the right defined for the ibay in which the folder is located, you can not make folders below an ibay accessible to a broader scope AFAIK.
Title: Re: php chmod in ibay
Post by: groyk on June 22, 2011, 10:35:28 AM
Hi Cactus

I-bay name: w-erp
Write: Group
Read: Everyone

Folders created like this mkdir($root . '/w-erp/files/testdir', 0777, true);

But when I check settings in shell dir has following chmod: dr----x--t

Maybe Chmod has to be 764 or 775 in order to work?
Title: Re: php chmod in ibay
Post by: CharlieBrady on June 22, 2011, 01:53:55 PM
Creating a folder with permissions 0777 is *always* a security problem, and is not supported on SME server.

Believe me, you don't need it.
Title: Re: php chmod in ibay
Post by: groyk on June 22, 2011, 08:54:33 PM
Got the solution

mkdir($dir);
chmod($dir, $mode);
chgrp($dir, $group);
Title: Re: php chmod in ibay
Post by: cactus on June 22, 2011, 09:12:31 PM
Got the solution

mkdir($dir);
chmod($dir, $mode);
chgrp($dir, $group);
I am not sure if the settings you set here will survive a configuration change to your ibay. A configuration change will reset all files and folders to the default permissions as enforced by the ibay the files and folders are in and reset them to the following values:

wr-admin-rd-group:
fileperm = 0640
dirperm = 02750

wr-group-rd-group:
fileperm = 0660
dirperm = 02770

wr-group-rd-everyone:
fileperm = 0664
dirperm = 02775
Title: Re: php chmod in ibay
Post by: groyk on June 22, 2011, 09:58:00 PM
I know.

This setup has to be reconfigured if ibays permissions are changed.