ownership and permissions

This is a discussion on ownership and permissions within the PHP General forums, part of the PHP Programming Forums category; t: 0131 553 3935 | m:07816 996 930 | ross@blue-fly.co.uk | http://www:blue-fly.co.uk I ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-06-2007
blueboy
 
Posts: n/a
Default ownership and permissions


t: 0131 553 3935 | m:07816 996 930 | ross@blue-fly.co.uk |
http://www:blue-fly.co.uk


I cannot delete a couple of folders on the server as the have the owner
'nobody'. All I am doing is making the folders with

mkdir($customer_id, 0755);


Now is there a way to set the ownership when I created the folder. What is
the appropriate folder levels for securoty (755, 640?)

Thanks,

R.
Reply With Quote
  #2 (permalink)  
Old 06-06-2007
Daniel Brown
 
Posts: n/a
Default Re: [PHP] ownership and permissions

On 6/6/07, blueboy <ross@aztechost.com> wrote:
>
> t: 0131 553 3935 | m:07816 996 930 | ross@blue-fly.co.uk |
> http://www:blue-fly.co.uk
>
>
> I cannot delete a couple of folders on the server as the have the owner
> 'nobody'. All I am doing is making the folders with
>
> mkdir($customer_id, 0755);
>
>
> Now is there a way to set the ownership when I created the folder. What is
> the appropriate folder levels for securoty (755, 640?)
>
> Thanks,
>
> R.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


If you search the archives, I wrote out a very long post on file
and folder security a few weeks back. Also, chances are, you can't
chown() the files with your PHP scripts, but you can do either....

<?
exec('rm -fR '.$customer_id.' >> 2>&1',$ret,$xc);
$xc == 1 ? echo $ret : '';
?>

.... or, by far easier....

<? unlink($customer_id); ?>

Since your existing scripts run as user: nobody, the file delete
script will, as well, meaning the files and folders that were created
via the web can be removed via the web.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Reply With Quote
  #3 (permalink)  
Old 06-07-2007
Myron Turner
 
Posts: n/a
Default Re: [PHP] ownership and permissions

blueboy wrote:
> t: 0131 553 3935 | m:07816 996 930 | ross@blue-fly.co.uk |
> http://www:blue-fly.co.uk
>
>
> I cannot delete a couple of folders on the server as the have the owner
> 'nobody'. All I am doing is making the folders with
>
> mkdir($customer_id, 0755);
>
>
> Now is there a way to set the ownership when I created the folder. What is
> the appropriate folder levels for securoty (755, 640?)
>
> Thanks,
>
> R.
>
>

If they are set to 600, and they were created by the web server, then
you won't be able to delete them under your own username, using ftp,
which is why filezilla doesn't work. But you should be able to write a
php script which can delete them when it is called from your browser.
Before you can remove the directory, you will first have to delete all
the files it holds:

$dir = "images";
foreach($files as $file) {
unlink ($dir. '/' .$file);
}

remdir($dir);

--

_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:51 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0