Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: Re RE: How to assign permissions to directory , programatically


Message #1 by "Amit " <amit_a_deshpande@r...> on 3 Jan 2002 06:26:29 -0000
Wait wait wait...

you're creating directories that the USERS own?  The webserver user won't be
able to access those directories unless you do something kind of tricky..

The first and only thing that comes to mind is that you'd have to create a
group for every new user.  The only two members of this group would be the
user and the webserver user.

When you chown the directory to the user, should also at this time set the
group owner to be the same as the webserver, and the rwx permissions on them
to be full for the group as well.

It sounds like it might be a pain to implement.

If you just create one group and put all the users into it, each user would
be able to get into all other users' directories.


Personally, I think a cleaner approach would be to have each user's file
directories under a userfiles/ directory from your html and php source, and
have it be owned only by the webserver user.

each user would have userfiles/username created for them, and they can
upload and download to their directory from the web.  What's nice about this
is that you can limit access to these directories via your own
authentication scheme, if you want.

I don't think you'll be able to offer ftp access to these dirs, though.

maybe someone else has a better solution -- it's been a long day for me. =)

nik



-----Original Message-----
From: Amit [mailto:amit_a_deshpande@r...]
Sent: Wednesday, January 02, 2002 10:26 PM
To: professional php
Subject: [pro_php] Re RE: How to assign permissions to directory ,
programatically



Hi Nik,
I am creating the directories on web server.
The idea is, my clients need to upload some files,
to be processed by programme, on server. I want their files to reside in
seperate directories ,created for them, while they register themselves with
my site, to keep their files safe and seperated.By using mkdir(), i am very
well able to create and assign permissions to these runtime created
directories , but due to the owner that is assigned to these , when they are
created, i am not able to upload files , thru php or ftp as well, coz owners
of these directories differ now. How do i cater to this problem ?

Thanks
Amit Deshpande


On Wed, 02 Jan 2002 Nikolai Devereaux wrote :
>
> If you're trying to create a directory on the client's
> machine, you can't do
> it.  Sorry.  PHP is a server-side scripting language.
>
> If you're creating a directory on your webserver for
> your user, you can do
> that, but your webserver must be running as a user with
> the appropriate
> permissions to create the directories in the first
> place.
>
> Put it simply -- if you can do it while logged in as
> the webserver user, you
> should be able to do it with PHP.
>
> It might take some tweaking and potentially unsafe
> (security-wise) user or
> group permissions settings for it to work.
>
> Good luck,
>
> nik
>
>
> -----Original Message-----
> From: Amit [mailto:amit_a_deshpande@r...]
> Sent: Wednesday, January 02, 2002 1:52 AM
> To: professional php
> Subject: [pro_php] How to assign permissions to
> directory ,
> programatically
>
>
>
> Hi everybody,
> WISH U ALL A VERY HAPPY AND PROSPEROUS NEW YEAR !!!!
>
> I have a problem of creating a directory on Linux and
> assign permisions to
> it in **run time**, using PHP.
> Say , when a new client registers , we make a database
> entry for him and
> create a directory in some name in **clients**
> directory and want to assign
> 777 permission to this directory.Please note that
> **clients** dir has 777
> permissions.How to assign a user to this dir and also
> the permissions. Using
> mkdir function isnt working for me. Can anybody shed
> some light on this ?
>
> Thanks
> Amir Deshpande
>
>
> ---
> Change your mail options at http://p2p.wrox.com/manager.-
> asp or
> $subst('Email.Unsub').
>
>
> ---
> Change your mail options at http://p2p.wrox.com/manager.-
> asp or
> $subst('Email.Unsub').





  Return to Index