масс - чмод

Discussion in 'PHP' started by [QwyZ], 29 Nov 2009.

  1. [QwyZ]

    [QwyZ] Banned

    Joined:
    7 Jul 2009
    Messages:
    71
    Likes Received:
    27
    Reputations:
    5
    никто неподкинет chmod'er папок и всех ПОДПАПОК в данной папке? то есть что бы поставил чмод на все и вся где лежит скрипт.спасибо.
     
    2 people like this.
  2. krypt3r

    krypt3r Elder - Старейшина

    Joined:
    27 Apr 2007
    Messages:
    1,507
    Likes Received:
    389
    Reputations:
    101
    Code:
    $ find . -type d | xargs chmod 0755
    
     
  3. Chubakur

    Chubakur Member

    Joined:
    6 Apr 2009
    Messages:
    48
    Likes Received:
    12
    Reputations:
    0
    find . -type d- это начиная с текущей папки ищем все директории. И делаем chmod
     
  4. [QwyZ]

    [QwyZ] Banned

    Joined:
    7 Jul 2009
    Messages:
    71
    Likes Received:
    27
    Reputations:
    5
    a kak eto na php realizovat?
     
  5. Chubakur

    Chubakur Member

    Joined:
    6 Apr 2009
    Messages:
    48
    Likes Received:
    12
    Reputations:
    0
    а блин, я что-то первый пост не прочитал. Я хз. На php вообще разве можно права задавать?
     
  6. [QwyZ]

    [QwyZ] Banned

    Joined:
    7 Jul 2009
    Messages:
    71
    Likes Received:
    27
    Reputations:
    5
    da,

    <?php

    chmod("xxx",0777);

    ?>
     
  7. Chubakur

    Chubakur Member

    Joined:
    6 Apr 2009
    Messages:
    48
    Likes Received:
    12
    Reputations:
    0
  8. [QwyZ]

    [QwyZ] Banned

    Joined:
    7 Jul 2009
    Messages:
    71
    Likes Received:
    27
    Reputations:
    5
    da,mne kazhetsa eto to chto nuzhno,spasibo Chubakur.
     
  9. svesve

    svesve Elder - Старейшина

    Joined:
    15 Jun 2007
    Messages:
    574
    Likes Received:
    86
    Reputations:
    11
    <?php
    system('chmod -R 0777 *');
    ?>
     
    1 person likes this.
  10. Chubakur

    Chubakur Member

    Joined:
    6 Apr 2009
    Messages:
    48
    Likes Received:
    12
    Reputations:
    0
    Но ведь это рекурсивно установит права на все файлы и каталоги, а надо только на каталоги. Как предлагаешь это сделать?
     
  11. [QwyZ]

    [QwyZ] Banned

    Joined:
    7 Jul 2009
    Messages:
    71
    Likes Received:
    27
    Reputations:
    5
    [Sun Nov 29 21:26:58 2009] [error] PHP Warning: chmod() [<a href='function.chmod'>function.chmod</a>]: Operation not permitted in /home/xxxx/yyyy/zzzz/cccc/vvvv/chmod.php on line 28

    pochemu NOT PERMITTED?
     
  12. mailbrush

    mailbrush Well-Known Member

    Joined:
    24 Jun 2008
    Messages:
    1,997
    Likes Received:
    996
    Reputations:
    155
    Потому что у тебя нет прав для выполнения chmod. Поставь сначала на сам скрипт
    Code:
    chmod 777 chomd.php
     
    1 person likes this.
  13. [QwyZ]

    [QwyZ] Banned

    Joined:
    7 Jul 2009
    Messages:
    71
    Likes Received:
    27
    Reputations:
    5
    stavil.nepomoglo
     
  14. [QwyZ]

    [QwyZ] Banned

    Joined:
    7 Jul 2009
    Messages:
    71
    Likes Received:
    27
    Reputations:
    5
    <?
    function recursiveChmod($path, $filePerm=0644, $dirPerm=0777)
    {
    if(!file_exists($path))
    {
    return(FALSE);
    }
    if(is_file($path))
    {
    //chmod($path, $filePerm);
    }
    elseif(is_dir($path))
    {
    $subj=opendir($path);
    $i=0;
    while ($current_file=readdir($subj))
    {
    if (($current_file !=".") && ($current_file != ".."))
    {
    $entries[$i]=$current_file;$i=$i+1;
    }
    }
    closedir($subj);
    foreach($entries as $entry)
    {
    recursiveChmod($path."/".$entry, $filePerm, $dirPerm);
    }
    echo("chmod(\"".$path."\",\""."0777"."\");<br>");
    chmod($path, 0777);

    }
    return(TRUE);
    }
    recursiveChmod(".",$filePerm=0644,$dirPerm=0777);
    ?>

    nepomoglo :( v logax tolko NOT PERMITTED
     
  15. Chubakur

    Chubakur Member

    Joined:
    6 Apr 2009
    Messages:
    48
    Likes Received:
    12
    Reputations:
    0
    Забавно, нет прав на изменение прав :)
     
  16. mailbrush

    mailbrush Well-Known Member

    Joined:
    24 Jun 2008
    Messages:
    1,997
    Likes Received:
    996
    Reputations:
    155
    А что здесь забавного? Типичная ситуация... ТС - попробуй еще и на папку, в котором скрипт установить чмод 777.
     
  17. [QwyZ]

    [QwyZ] Banned

    Joined:
    7 Jul 2009
    Messages:
    71
    Likes Received:
    27
    Reputations:
    5
    na root na www i na vse postavil 777 i vse ravno NOT PERMITTED....
    ..
     
  18. gisTy

    gisTy Elder - Старейшина

    Joined:
    24 May 2008
    Messages:
    432
    Likes Received:
    160
    Reputations:
    27
    phpinfo() disable functions встудию
    и поставь на
    Code:
    /home/xxxx/yyyy/zzzz/cccc/vvvv/
    и на файл chmod.php права в 0777
     
    #18 gisTy, 29 Nov 2009
    Last edited: 29 Nov 2009
  19. svesve

    svesve Elder - Старейшина

    Joined:
    15 Jun 2007
    Messages:
    574
    Likes Received:
    86
    Reputations:
    11
    пробуй то что написал krypt3r
    только так

    <?php
    system('find -type d -exec chmod 755 {} \');
    ?>
     
  20. [QwyZ]

    [QwyZ] Banned

    Joined:
    7 Jul 2009
    Messages:
    71
    Likes Received:
    27
    Reputations:
    5
    poprobuyu kak iz shkoly pridu...u nas sha kak raz informatika... prosto na masterhost ne ais lezt iz pod kompa, gde mozhet byt keylogger....