Koozali.org: home of the SME Server

php chmod in ibay

Offline groyk

  • ****
  • 140
  • +0/-0
php chmod in ibay
« 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.

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: php chmod in ibay
« Reply #1 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.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline groyk

  • ****
  • 140
  • +0/-0
Re: php chmod in ibay
« Reply #2 on: June 22, 2011, 09:29:16 AM »
I want to be able to create, modify, delete in samba share as well.

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: php chmod in ibay
« Reply #3 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.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline groyk

  • ****
  • 140
  • +0/-0
Re: php chmod in ibay
« Reply #4 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?

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: php chmod in ibay
« Reply #5 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.

Offline groyk

  • ****
  • 140
  • +0/-0
Re: php chmod in ibay
« Reply #6 on: June 22, 2011, 08:54:33 PM »
Got the solution

mkdir($dir);
chmod($dir, $mode);
chgrp($dir, $group);

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: php chmod in ibay
« Reply #7 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
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline groyk

  • ****
  • 140
  • +0/-0
Re: php chmod in ibay
« Reply #8 on: June 22, 2011, 09:58:00 PM »
I know.

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